Click here to Skip to main content
16,007,126 members
Home / Discussions / Java
   

Java

 
AnswerRe: array string index Pin
fly90425-Jul-09 2:56
fly90425-Jul-09 2:56 
QuestionEfficient way of printing elements in Java?! Pin
Rajdeep.NET24-Jul-09 8:36
Rajdeep.NET24-Jul-09 8:36 
AnswerRe: Efficient way of printing elements in Java?! Pin
fly90424-Jul-09 8:42
fly90424-Jul-09 8:42 
AnswerRe: Efficient way of printing elements in Java?! Pin
Nagy Vilmos27-Jul-09 3:37
professionalNagy Vilmos27-Jul-09 3:37 
AnswerRe: Efficient way of printing elements in Java?! Pin
EliottA5-Aug-09 9:12
EliottA5-Aug-09 9:12 
QuestionRun ruby code on java Pin
xax24-Jul-09 6:15
xax24-Jul-09 6:15 
AnswerRe: Run ruby code on java Pin
Kujtim Hyseni25-Jul-09 0:59
Kujtim Hyseni25-Jul-09 0:59 
QuestionReference in Java Pin
Kujtim Hyseni24-Jul-09 5:32
Kujtim Hyseni24-Jul-09 5:32 
Hello,

this is a simple question I think. I am trying to get the array of bytes as a reference from method, although in the method in creates the array, outside returns the original initialized with null. How to get it from routine, but as parameter since routine returns boolean. Maybe routine should return class containing the array and boolean variable.

This is the code:

public class PassingRefs{

	static boolean varbyteobject(byte [] obj)
	{
		System.out.println("---inside routine---");
		int rndlen=(int)(Math.round(Math.random()*50)+1);
		
		obj=new byte[rndlen];
		System.out.println(obj.length);
		
		return true;
	}

	public static void main(String [] args){
		byte [] inpobj=null;
		varbyteobject(inpobj);
		System.out.println("---out from routine---");
		System.out.println(inpobj.length);
	}

}


and this is what I get after execution:

---inside routine---
29
---out from routine---
Exception in thread "main" java.lang.NullPointerException
	at PassingRefs.main(PassingRefs.java:18)


Kujtim
AnswerRe: Reference in Java Pin
David Skelly24-Jul-09 6:12
David Skelly24-Jul-09 6:12 
AnswerRe: Reference in Java Pin
fly90424-Jul-09 6:21
fly90424-Jul-09 6:21 
AnswerRe: Reference in Java Pin
Kujtim Hyseni24-Jul-09 7:02
Kujtim Hyseni24-Jul-09 7:02 
GeneralRe: Reference in Java Pin
David Skelly26-Jul-09 22:35
David Skelly26-Jul-09 22:35 
GeneralRe: Reference in Java Pin
Kujtim Hyseni27-Jul-09 1:38
Kujtim Hyseni27-Jul-09 1:38 
GeneralRe: Reference in Java Pin
David Skelly27-Jul-09 2:18
David Skelly27-Jul-09 2:18 
AnswerRe: Reference in Java [modified] Pin
Kujtim Hyseni27-Jul-09 3:36
Kujtim Hyseni27-Jul-09 3:36 
GeneralRe: Reference in Java Pin
David Skelly27-Jul-09 5:34
David Skelly27-Jul-09 5:34 
GeneralRe: Reference in Java Pin
Nagy Vilmos27-Jul-09 5:54
professionalNagy Vilmos27-Jul-09 5:54 
QuestionIs Javascript question allowed here??? Pin
kKamel22-Jul-09 0:34
kKamel22-Jul-09 0:34 
AnswerRe: Is Javascript question allowed here??? Pin
fly90422-Jul-09 0:41
fly90422-Jul-09 0:41 
GeneralRe: Is Javascript question allowed here??? Pin
Nagy Vilmos22-Jul-09 0:42
professionalNagy Vilmos22-Jul-09 0:42 
GeneralRe: Is Javascript question allowed here??? Pin
kKamel22-Jul-09 0:49
kKamel22-Jul-09 0:49 
GeneralRe: Is Javascript question allowed here??? Pin
Nagy Vilmos22-Jul-09 1:41
professionalNagy Vilmos22-Jul-09 1:41 
QuestionIs there any way to convert a word document into PDF using openoffice and JOD convertor : without installation of OpenOffice ? Pin
AshishAshish21-Jul-09 2:51
AshishAshish21-Jul-09 2:51 
AnswerRe: Is there any way to convert a word document into PDF using openoffice and JOD convertor : without installation of OpenOffice ? Pin
fly90421-Jul-09 3:35
fly90421-Jul-09 3:35 
GeneralRe: Is there any way to convert a word document into PDF using openoffice and JOD convertor : without installation of OpenOffice ? Pin
AshishAshish23-Jul-09 3:09
AshishAshish23-Jul-09 3:09 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.