No one has voted on any posts yet. Votes from other community members are used to determine a member's reputation amongst their peers.
[CODE]class A{ A a=new A(); void method(){ System.out.println(a); } public static void main(String args[]){ A b=new A(); b.method(); } }[/CODE] This code gives a run time error.What is the wrong with this code |
|
Re:
Can someone please explain break statements to me, as far as i understand a break statement leaves the loop before it has ended. But i run this code and expect to get "Zero" "One" But I get "Zero" "One" "One" "Unknown number" [CODE] for (int i = 0; i < … |
|
[CODE]class A{ void method(){ System.out.println("Hello world"); } } class B{ void myMethod(){ A.method(); } }[/CODE] Can anyone tell me why I am getting this error.( non-static method method() cannot be referenced from a static context).Reffering context is not static.:?: |
|
Re:
Hi Everyone, So I just finished writing a program from my Java class,except I can't figure out how to validate the bookID. "In the Book class, you need to provide a validate method that validate weather the book id is correct. The book id should be a [B]string[/B], which contains … |