Win a copy of Terraform in Action this week in the Cloud forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

Program Control Flow

 
Greenhorn
Posts: 9
Netbeans IDE Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please help, What is the output ?
question1.png
[Thumbnail for question1.png]
 
Saloon Keeper
Posts: 13426
302
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What do you mean by "dry run"? This phrase is usually used for commands that have side effects that change system state. The application you posted doesn't change any state, so the phrase "dry run" is meaningless.

Do you know how to compile and run Java applications? Are you familiar with jshell?
 
Munyaradzi Matindike
Greenhorn
Posts: 9
Netbeans IDE Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Stephan van Hulst wrote:What do you mean by "dry run"? This phrase is usually used for commands that have side effects that change system state. The application you posted doesn't change any state, so the phrase "dry run" is meaningless.

Do you know how to compile and run Java applications? Are you familiar with jshell?



i have rephrased the question thanks for the correction.
 
Stephan van Hulst
Saloon Keeper
Posts: 13426
302
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you have Java 9+ installed and your environment variables configured properly, you can run jshell from your command line. From there you can enter the application as given, and it will spit out the answer.
 
Munyaradzi Matindike
Greenhorn
Posts: 9
Netbeans IDE Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Stephan van Hulst wrote:If you have Java 9+ installed and your environment variables configured properly, you can run jshell from your command line. From there you can enter the application as given, and it will spit out the answer.


the answer is that it produces a infinite loop i need a brief explanation of how it is so ?
 
Stephan van Hulst
Saloon Keeper
Posts: 13426
302
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please explain to us what you think happens when m == 3.
Staff note (Jesse Silverman) :

This was most decidedly not in the Advanced scope of the Developer Certification (OCMJD) exam, and this exam (and forum) seems to be retired.
We might want to figure out how it wound up in this forum so others do not get lost here, we also might want to move this. It seems far more likely that the poster is targeting the 811, I would think, as would most others who would be confused about this problem.
I was wondering how I missed this, I intentionally ignore this forum as no longer relevant to still-existing exams.

 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic