Saturday, May 11, 2019

what is the output of the of following code? Explain.

Problem statement:
Both the classes ExecutionThree and ExecutionFour are saved in ExecutionThree.java
  1. public class ExecutionThree {
  2.     public static void main(String[] args) {
  3.         System.out.println("ExecutionThree");
  4.     }
  5. }
  6. class  ExecutionFour{
  7.     public static void main(String[] args) {
  8.         System.out.println("ExecutionFour");
  9.     }
  10. }
Output:
Output will depend on how we want to run the class. 
For example:-
If we are running this program in any of the IDE(Integrated Development Environment) without terminal then the IDE will print the output as ExecutionThree

If we are running this program using terminal even in the IDE's terminal, then we must use java tool command.
For it below are the steps:
step-1: javac FileName.java
            javac ExecutionThree.java
step-2: java ClassName
            java ExecutionThree
step-3: output - ExecutionThree
step-4: java ExecutionFour
step-5: output - ExecutionFour

No comments:

Post a Comment

How to run standalone mock server on local laptop

 Please download the standalone wiremock server from Direct download section at the bottom of the page.  Download and installation Feel fre...