Computer Science, asked by hninnwephyo13, 1 year ago

Suppose you have written a Java program that has one class and one method. Which one of the following best describes what you need to do in order to run the program? Create a new object for the class, call the method, and then compile the program. Compile the program, create a new object for the class, and call the method. Compile the program, call the method, and then create a new object for the class. Create a new object for the class, compile the program, and call the method.

Answers

Answered by xSahiBx
0

Answer:

__________________________________

Option 3 is the correct sequence to run the java program.

Explanation:

The Java programming language is the object-oriented programming language. So it needs to write the program in the form of class and object in which the class is the structure and object is used to execute the class member.

The above questions have one class and one member on it. so to call the method, the user has to create one object and then the method can be called by the help of that object.

The compilation of any program can be done after the completion of the program's code and before the execution of the program to change the instruction into machine language.

So for the above scenario, the user needs to create the objects then call the method and then compile the program (reason defined on the above line) which is stated from option 3. Hence the correct option is 3 while the other is not because all are the (except option 3) incorrect sequence.

__________________________________

Similar questions