Rewrite for your code is here,
Put your "Student" class in the same package then Main.java;
package MyPackage
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args) throws NumberFormatException, IOException {
// TODO Auto-generated method stub
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
Student stu = new Student();
float sub1 = 0;
int goThere = 0;
do {
switch(goThere){
case -1:
System.out.println("if U want 2 use further press 0 to continue...");
goThere = Integer.parseInt(br.readLine());
continue;
case 0:
System.out.println("--------------STUDENT DETAILS---------------");
System.out.println("Choose the operation from the following options.");
System.out.println(" 1.ADDNAME");
System.out.println(" 2.AVERAGE_RESULT");
System.out.println(" 3.EXIT");
System.out.println("CHOOSE THE OPERATION U WANT:");
goThere = Integer.parseInt( br.readLine() );
continue;
case 1:
System.out.println("Enter the name");
String name = br.readLine();
System.out.println("The Inserted student name is " + stu.addName(name));
goThere = -1;
continue;
case 2:
System.out.println("Enter the marks (in 100):");
System.out.println("Subject 1:");
sub1 = Float.parseFloat(br.readLine());
goThere = 4;
continue;
case 4:
if( sub1 >= 101){
goThere = 2;
continue;
}
System.out.println("Subject 2:");
float sub2=Float.parseFloat(br.readLine());
System.out.println("Subject 3:");
float sub3=Float.parseFloat(br.readLine());
System.out.println("The Student is " + stu.average(sub1,sub2,sub3) + "in the examinations");
goThere = -1;
continue;
}
break;
} while(true);
}
}