Learning java, need explanation on error I am getting | Sololearn: Learn to code for FREE!
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(); } }

17th Feb 2018, 2:23 PM
BalboaCODING
BalboaCODING - avatar
1 Odpowiedź
+ 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
17th Feb 2018, 3:29 PM
Sad
Sad - avatar