Hiya! I just recently learn about the "this" keyword and constructor.I'm a Java newbie.I'm having a few errors within my code and am quite baffled.
I would greatly appreciate if you could explain what I done wrong.
Thanks everyone!
class Student{
// instance variables
String Name;
String Surname;
public Student(String N,String S)
{
this.Name=N;
this.Surname=S;
}
public String getandprint()
{
System.out.println("The student name is:"+"N"+"S");
} //missing return statement
}
class System1{
public static void main(String [] args)
{
Student obj = new Student(Jim,Jones); // cannot find symbol name for names
//System.out.println("The student name is:"+obj.Name+obj.Surname);
}
}