Activity Feed
My Posts
Post Details | Date Published | Views | Kudos |
---|---|---|---|
Programming Problem in ATA Prerequisites Course Module 5 ControlFlow CA-2-A ...'m not sure how to get around this. Here is the code that I wrote. public void printResult(){ double currentResult; System.out.println(currentResult); } |
a week ago |
134 |
0 |
a week ago
I am a student enrolled in the ATA Prerequisites Course. I am currently working on the Module 5 Methods Problem in Vocareum. I am stuck on Step 2. The instructions are as flows Define a method named printResult (below the comment for this step). It should not return a value or accept any parameters. Declare an instance variable named currentResult of the double data type, but do not initialize it. Note: Make sure to declare this variable without an explicit access modifier. Although it is usually best practice to declare instance variables as private, for this activity, declare it without using the private access modifier. In the body of the method call the System.out.println() method using the currentResult instance variable as the argument. The issue that I am having is with the declaration of the currentResult local variable. I get a compiler error saying that currentResult is not initialized. I'm not sure how to get around this. Here is the code that I wrote. public void printResult(){ double currentResult; System.out.println(currentResult); }
... View more