In this programme I have got the error symbol not found
please solve my issue. I have check all the lines, but I found all are correct. And though the compiler gives this error in ec.setName = input.next();
line. So please somebody help me to solve this.
Here my code:
import java.util.Scanner;
class Encapsul
{
private String name;
private int roll_no;
private float marks;
private double total;
private String school;
public String getName() {
return name;
}
public int getRoll_no() {
return roll_no;
}
public float getMarks(){
return marks;
}
public double getTotal(){
return total;
}
public String getSchool(){
return school;
}
public void setName(String newName) {
name = newName;
}
public void setRoll_no(int newRoll_no) {
roll_no = newRoll_no;
}
public void setMarks(float newMarks) {
marks = newMarks;
}
public void setTotal(double newTotal) {
total = newTotal;
}
public void setSchool(String newSchool) {
school = newSchool;
}
}
class Test{
public static void main(String args[]){
Scanner input = new Scanner(System.in);
Encapsul c = new Encapsul();
System.out.println("please enter the Name");
c.setName = input.next();
System.out.println("please enter the roll_no");
c.setRoll_no = input.nextInt();
System.out.println("please enter the marks");
c.setMarks = input.nextFloat();
System.out.println("please enter the total");
c.setTotal = input.nextDouble();
System.out.println("please enter the school");
c.setSchool = input.next();
System.out.println("Name :"+ c.getName());
System.out.println("Roll no :"+ c.getRoll_no());
System.out.println("Marks :"+ c.getMarks());
System.out.println("Total :"+ c.getTotal());
System.out.println("School :"+ c.getSchool());
}
}