Remove the extra }
from your code:
public class Sphere {
public static void main(String[] args) {
// } //Remove this
// public int diam; // get rid of the public modifier here
int diam;
Scanner input = new Scanner(System.in);
System.out.println("Please enter diameter"); //error on this line
} // add curly brace here
}
Also you cannot declare variable as public
inside a method. public int diam;
is an illegal statement. Remove that public modifier.