The required number

  • 3
  • Locked
Imagine that for some reason you need a specific number, and until you get it, nothing good will happen (or something bad will happen). Have you got a picture of that in your mind? Do you have a feel for your role? Good, now let's complete an interesting task. We have some code. You need to comment out as many lines as possible to make the program display the number 19.
You can't complete this task, because you're not signed in.
Comments (31)
  • Popular
  • New
  • Old
You must be signed in to leave a comment
Jeff Kenney
Level 3 , United States
1 December 2021, 05:49
Just as a refresher: Does the value of the variable change based on the last line of code defining the value of the variable?
Jeff Kenney
Level 3 , United States
1 December 2021, 05:44
Error: My favorite number is five. Cannot complete task 😐.
9 August 2021, 09:28
Fun one,it's an interesting way to get used to interactions between lines of code.
AlasCaras
Level 4 , Corpus Christi, United States
6 February 2021, 06:03
Only the lines with "2" in them should be comment out.
Ahu
Level 5 , Slough, United Kingdom
5 October 2020, 16:58
Again, I managed it, because I used an online java compiler and randomly comment and uncomment the lines. Through randomly commenting and uncommenting I got the solution, but in all seriousness it is just waste of my time because a) I don't know what I am doing, b) there is no explanation how someone supposed to calculate or find it out on her/his own , c) I doubt this is helping me to understand class and objects.
Ahu
Level 5 , Slough, United Kingdom
5 October 2020, 16:52
I really hate this sort of tasks and I have doubt it is helping with learning Java.
Keston Bailey
Level 4 , Milwaukee, United States
29 April 2020, 22:01
So how do you solve this problem not using trial and error??
theCalculator
Level 3 , Warren, United States
16 August 2019, 00:35
If the print method is calling the y variable shouldn't I automatically by deduction comment out any x variable?
theCalculator
Level 3 , Warren, United States
16 August 2019, 00:33
Please advise in the print method or main method is the command given to add, subtract or multiply these x and y variables?
theCalculator
Level 3 , Warren, United States
16 August 2019, 00:26
I must have over looked some instruction. If I plug in the values none of them appear to return 19. So now when I comment out the lines how am I suppose to arrive at 19? I mean the print line only says print y so what is exactly happening? Are there operations taking place by default?