menu
QAmmunity.org
Login
Register
My account
Edit my Profile
Private messages
My favorites
Register
Ask a Question
Questions
Unanswered
Tags
Categories
What will be the output of the following code?int p = 3,ch = 2;switch(ch){case 1: System. Out. Println("The square is: " + p*p);break;case 2: System. Out. Println("The cube is: " + p*p*p);break;default:
asked
Nov 5, 2023
227k
views
2
votes
What will be the output of the following code?int p = 3,ch = 2;switch(ch){case 1: System. Out. Println("The square is: " + p*p);break;case 2: System. Out. Println("The cube is: " + p*p*p);break;default: System. Out. Println("No Output Value");}
Computers and Technology
high-school
Netsurfer
asked
by
Netsurfer
8.1k
points
answer
comment
share this
share
0 Comments
Please
log in
or
register
to add a comment.
Please
log in
or
register
to answer this question.
1
Answer
9
votes
“The cube is: 27”
or p^3
The switch function uses the ch int and identifies a matching case. Because ch is 2
We use case 2
Thus the following line at the top is printed.
Then automatically breaks the function, so we don’t continue.
Kostas Andrianos
answered
Nov 10, 2023
by
Kostas Andrianos
8.5k
points
ask related question
comment
share this
0 Comments
Please
log in
or
register
to add a comment.
Ask a Question
Welcome to QAmmunity.org, where you can ask questions and receive answers from other members of our community.
9.5m
questions
12.2m
answers
Other Questions
“What does it mean when we “rework” copyrighted material?”
The book shows how to add and subtract binary and decimal numbers. However, other numbering systems are also very popular when dealing with computers. The octal (base 8) numbering system is one of these.
Please help me ! All you do is just put it it all in your own words ! Please this is for my reported card!i don't know how to put it in my own words because my English is not that good!
Disadvantages of using animation in advertising? advantages and disadvantages of using animation for education? advantages and disadvantages of using animation in entertainment?
Explain why binary codes are used to represent characters, numbers and symbols :)
Twitter
WhatsApp
Facebook
Reddit
LinkedIn
Email
Link Copied!
Copy
Search QAmmunity.org