error: non-static variable average cannot be referenced from a static context : <p>Write a program to input marks of three subjects for a student and calculate the average marks.
In your class.
a) Include a constructor to initialize the three marks to 0
b) Include a method to calculate and store the average
c) Include a method to display the student ID,name and the average marks of the student</p>

<pre><code>import java.util.Scanner;
public class Main{
    int mark1;
    int mark2;
    int mark3;
    float total;
    float average;
public Main(){
    int mark1=50;
    int mark2=60;
    int mark3=70;
    float total=0;
    float average=0;
}
  public static void main(String args[]){
    Main myb = new Main();
     Scanner my = new Scanner(System.in);
     System.out.println("Enter marks for First subject");
     int marks1 = my.nextInt();
     System.out.println("Enter marks for Second subject");
     int marks2 = my.nextInt();
     System.out.println("Enter marks for Third subject");
     int marks3 = my.nextInt();
     total = marks1+marks2+marks3;
     average = total/3;
     System.out.println("Total is "+myb.total);
     System.out.println("Total is "+myb.average);
    /*Student stud1=new Student("IT9087567","Kamal",50,60,70);
    stud1.showDetail();*/
  }


}
</code></pre>
