Question: All please answer all questions and the programs are in Java. 1. Create a little program using command-line argument. Input (command line): java HelloBuddy John
All please answer all questions and the programs are in Java.
1. Create a little program using command-line argument. Input (command line): java HelloBuddy John Mary Tom
Output: Hello John!
Hello Mary!
Hello Tom!
3. What is the value of the String S after the following line?
String S = (new String("arach")).substring(0,2) +
(new String("nophobia")).substring(3);
3. What is the output of the following code segment (trick: break)?
char x = A;
while(x != D){
switch(x){
case A: System.out.println(x); x = D;
case B: System.out.println(x); x = C; break;
case C: System.out.println(x); x = D;
default: continue;
}
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
