I WAS JUST EXPERIMENTING SOMETHING.
AFTER COMPILING THIS I GOT THE ERROR: "<identifier>expected x=1;"
i have got this error many times, but don't know why this occurs
and also i have made the object of the class dabba in the dabba class's main method, is it wise thing to do??????
import java.lang.*;
class dabba
{
int x;
x=1;
int a[]=new int[11];
public static void main(String args[])
{
dabba d=new dabba();
d.x=10;
System.out.println("x di value hai"+d.x);
}
}
one thing more, if i access x without the object d in println() method, then its giving an error too, i mean i know its not a static variable, but why should it give an error in a method like println if i access without object, for ex:-
System.out.println("x di value hai"+x); //error
please solve my problem as i have lost touch with java from the last 7 months and 7 months losing touch with a language is like starting from 0 in that language :-(