I have a student object that can hold name and mark.
public class Student{
Public String name;
Public int mark;
public Student (int argMark, String argName)
{ mark=argMark; name=argName;}
}
when I create a student as :
Student john = new Student(70, "John");
I need to change the mark later while keeping the previous marks
Student temp = john;
temp.mark = 60;
when I print them out they both have 60 marks
System.out.println(temp.mark);
System.out.println(john.mark);
the system shows the answer of : 60 for both of them
I know I can extend a class and have a method for get, set methods and override it, but this is not acceptable for my assignment. Is there any other way to do this?