Monday, August 6, 2018

Java Apptitude Question

public class Myfile
{
    public static void main (String[] args)
    {
        String biz = args[1];
        String baz = args[2];
        String rip = args[3];
        System.out.println("Arg is " + rip);
    }
}
Select how you would start the program to cause it to print: Arg is 2
java Myfile 222
java Myfile 1 2 2 3 4
java Myfile 1 3 2 2


 




2.What will be the output of the program?
class Test
{
    public static void main(String [] args)
    {
        int x=20;
        String sup = (x < 15) ? "small" : (x < 22)? "tiny" : "huge";
        System.out.println(sup);
    }
}
small
tiny
huge
Compilation fails

No comments:

Post a Comment

Which Python course is best for beginners?

Level Up Your Python Prowess: Newbie Ninjas: Don't fret, little grasshoppers! Courses like "Learn Python 3" on Codecade...