Java Queries Here..

chandru.in

In the zone
I have never used Comet, but if you are using JSF by any chance, both Richfaces and IceFaces provide push capabilities. Icefaces uses long living connections while Richfaces uses a lightweight polling mechanism to simulate a push.
 

Plasma_Snake

Indidiot
^^ SO wrong mate, .jar games or Java games can be played on any Java enabled phone, that's the beauty of it. I myself played the Gameloft's Chess game on my E51, a S60v3 phone, which I earlier used to play on my 5200, a S40v3 phone. I haven't tried playing same Java game on any SE phone but I'm pretty sure that it will work.
 

gopi_vbboy

Cyborg Agent
actaully i have a bluetooth game-Planet riders which im unable to play with ma freinds havinf nokia xpress music phone n n73.....but working on sony phones perfectly....

in nokia n73 after installing game from jar file...when i open i doesnt do anything...jus stand atill..doesn hang but sometimes say apllication error....n doesn work at all
 

silent008

Broken In
Consider the following structure

class A{
//something valid
}
class B
{
int id;
A abc[];
b()
{abc=new A[10];}
}

let A temp=new A();
and is initialized
and
B xyz[]=new B[10];
now when i try this

for(i=0;i<10;i++)
for(j=0;j<10;j++)
xyz.abc[j]=temp;

I get java.lang.nullpointer exception


Please Help me!!!! I am new to java
 

Bandu

Journeyman
^Your xyz array is only "declared" to be of type B and size 10. You haven't initialized it yet. So, when you try to use it, you face a nullpointer exception. I guess at the very first iteration of the loop (when i = 0). Assign 10 B objects to each of the xyz array elements and you should be fine.

Code:
for(int i=0;i<10;i++)
    for(int j=0;j<10;j++)
    {
        xyz[i] = new B();
        xyz[i].abc[j]=temp;
    }
 
Last edited:

silent008

Broken In
^Your xyz array is only "declared" to be of type B and size 10. You haven't initialized it yet. So, when you try to use it, you face a nullpointer exception. I guess at the very first iteration of the loop (when i = 0). Assign 10 B objects to each of the xyz array elements and you should be fine.

Code:
for(int i=0;i<10;i++)
    for(int j=0;j<10;j++)
    {
        xyz[i] = new B();
        xyz[i].abc[j]=temp;
    }
Thanks Bandu,
That worked

And sorry for the noobie question. As I am new to Java I got confused. I thought B xyz[]=new B[10] is enough to initialize

Thanks Again!!!!
 

c2tarun

N3CrO..NiNj@**
i just gone through wrapper classes
Integer, Byte, and etc are wrapper classes.
they do have some functions and there objects can be created simply like other classes...

WHAT I DONT UNDERSTAND ABOUT KEYWORD 'int' IS WHAT XACTLY IS THE MEANING, USE AND ITS RELATION TO INTEGER CLASS....
THANK YOU
 
Last edited:

vamsi360

Always confused
i just gone through wrapper classes
Integer, Byte, and etc are wrapper classes.
they do have some functions and there objects can be created simply like other classes...

WHAT I DONT UNDERSTAND ABOUT KEYWORD 'int' IS WHAT XACTLY IS THE MEANING, USE AND ITS RELATION TO INTEGER CLASS....
please reply and if u do have any notes about this plz send it to me at c2tarun@gmail.col
THANK YOU

int is a primitive data type and Integer is a class i Java. All numeric primitive types are sub in Integer class. So if you are using Generics there you got to use Integer to create a generic variable than to use int type which gives an error.

For even detailed explanation read Generics chapter in Complete Reference book.

As I have learned in this forum.......DONT post your email id publicly , avoid spam.
 

c2tarun

N3CrO..NiNj@**
hi everybody
can anyone plz tell me is there a function of method in java to clear console screen.
like 'clrscr()' in c++;
 

chandru.in

In the zone
clrscr() is a proprietary Turbo C function. It is not even a standard C/C++ function.

Also, the use of Java for developing pure console application is very rare. Java rules the middleware space and quite popular in enterprise web and desktop applications. These rarely need console output.
 

nitish_mythology

OSS Enthusiast!
The Code prints diff hashCodes for the two objects..
Still the objects are reported to be equal!! Why is that so??

class Hs
{

int x;

public Hs()
{
x=11;
}


public boolean equals (Object o)
{
Hs rf=(Hs) o;

if(this.x==rf.x)
return true;
else
return false;
}

}

class TryMe
{
public static void main(String args[])
{
TryMe tm=new TryMe();
TryMe tm2=new TryMe();


System.out.println(tm.hashCode());
System.out.println(tm2.hashCode());

//Here two hashcodes were shown diff
if(tm.equals(tm2))
System.out.println("Equal");
else
System.out.println("NOT EQUAL");

}

}
 
Top Bottom