Sunday, February 22, 2009

simple example to show the static variables



// example to declaration the static variables

package variables;

class Student {
String name;
int rollno;
static String collname;
public static void main(String arg[]) {
Student s1=new Student();
System.out.println(s1.name); // null
System.out.println(collname); // null (here with out useing object get collname)
}
}




0 comments:

Post a Comment