Thursday 29 August 2013

HOW TO USE STATIC KEYWORD AS METHOD AND VARIABLE

class student
{
      int rollno;
      String name;
     static String college="GROW MORE";
       student(int r,String n)
       {
        rollno=r;
        name=n;
        }
       static void change()
        {
         college="VN";
        }
       void display()
        {
       
           System.out.println(rollno+" "+name+" "+college);
         }
     public static void main(String Dx[])
     {    
            change();
           

             student s1=new student(111,"KARMA");
             student s2=new student(222,"NIRAV");
           
         
             s1.display();
             s2.display();    
    }

}

No comments:

Post a Comment

How to change Background color by selecting color from Listview

activitymain.xml file::> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"     xm...