What output results from this code? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 1

What output results from this code?

public static void main(String[ ] args) { doSomething(4); } static void doSomething(int x) { System.out.println(x*x); }

20th Jan 2017, 11:19 AM
Lilli Mifflin
13 Answers
+ 5
results = 16
27th Oct 2017, 8:12 PM
Mohammad Javad.Sami
+ 3
I will never understand those questions here. The answer is 5 clicks away. * click on "CODE PLAYGROUND" right near "DISCUSS" * click on "NEW CODE" * select "Java" * paste your code * click on "RUN" Thats _way faster_ than create a Question, type a topic, paste code, type tags, submit and reload every 5s to get an answer after a hour. AND - You learn something from it. Edit: "CODE PLAYGROUND" == {}, "NEW CODE" == + on mobile devices ;)
20th Jan 2017, 12:10 PM
bem
bem - avatar
+ 2
2
28th Dec 2019, 5:16 AM
Shavinu
Shavinu - avatar
+ 1
I think 16.
20th Jan 2017, 11:21 AM
Divesh Agarwal
Divesh Agarwal - avatar
0
The output will be 16. 4*4=16
6th Apr 2021, 10:34 AM
Joseph S. Lablah, Jr
Joseph S. Lablah, Jr - avatar
0
16
22nd Apr 2022, 11:39 AM
mallampati madhusree
0
What output results from this code? public static void main(String[ ] args) { doSomething(4); } static void doSomething(int x) { System.out.println(x*x); } Answer-16
30th Apr 2022, 5:54 AM
MAREESWARAN S
MAREESWARAN S - avatar
0
16
7th May 2022, 11:24 AM
U.L.F. Feroza
0
16
30th Jun 2022, 12:54 AM
Opanuga Stephen
Opanuga Stephen - avatar
0
16
3rd Jul 2022, 7:18 AM
Antenhe Yimer
- 1
Answer will be 4
24th Oct 2018, 10:37 AM
Ashish Mishra
- 1
answer is :2
9th Jan 2019, 5:36 AM
K. Asma nikhath
K. Asma nikhath - avatar
- 1
4
14th Jul 2019, 10:35 AM
PRASAD MOHAN CHOUGALE
PRASAD MOHAN CHOUGALE - avatar