0
Learning java, need explanation on error I am getting
Its the code package Operators; import java.util.Scanner; public class OperatorsExample1 { public void hmm(){ Scanner sc=new Scanner(System.in); int x,y,z; System.out.println("Enter the value of x"); sc.nextInt(); System.out.println("Enter the value of y"); sc.nextInt(); z=x+y; //getting error here System.out.println("The value z"); sc.nextInt(); } public static void main(String[] args) { // TODO Auto-generated method stub OperatorsExample1 oo= new OperatorsExample1(); oo.hmm(); } }
1 Answer
+ 1
One error is that you should write:
x = sc.nextInt()
and y = sc.nextInt();
And then another error comes that I dont know :p