Im getting the wrong output of 1, the output should be 101. what is im doing wrong?

Im getting the wrong output of 1, the output should be 101. what is im doing wrong? I try just p in the out and i get 1. Then I try p,q,r and I get this error messaage.

mport java.util.*;
public class walt22
{
   
public static void main(String[] args)
{

int x=1, y=6, z=2;
int p =0,q=0,r=0;
if(x+y+z<=10)
p++;
else
q++;
r++;
System.out.println(p,q,r);

}
}
walt22.JPG
waltbaby315Asked:
Who is Participating?
 
msk_apkCommented:
there is no method out.println(int a , int b , int c) in System. you have to print

System.out.print(p);
System.out.print(q);
System.out.print(r);
0
 
cmalakarCommented:
>> System.out.println(p,q,r);

is wrong..

if you want to print all the values of p,q,r separately, it should be

System.out.println("p:" + p + ", q:" + q + ", r:" + r);
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.