I am creating the project MyOwnProject for 1014 homework. I cannot
find out what is wrong in this code.
displays error. package sr1 does not exist and also identifier
expected. If i remove the function and static variable studentId.
things become ok>>>

public class Student {

    /**
     * @param args the command line arguments
     */


    public static void main(String args[])
    {
        // TODO code application logic here
        public static int studentId=0;
        public void setStudentId(int id){
            studentId =id;
        }
        public int getStudentId()
        {
            return studentId;
        }
        //making three instances of student recod class
        StudentRecord sr1=new StudentRecord();
        StudentRecord sr2=new StudentRecord();
        StudentRecord sr3=new StudentRecord();
        //set the names of student & increasing the count

        sr1.setName("Amit");
        StudentRecord.increaseStudentCount();

        sr2.setName("Navneet");
        StudentRecord.increaseStudentCount();

        sr3.setName("Happy");
        StudentRecord.increaseStudentCount();
//displaying the name
       System.out.println(sr1.getName());
        System.out.println(sr2.getName());
        System.out.println(sr3.getName());



    }

}

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/javaprogrammingwithpassion?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to