Question: PART 1 PART 2 PART 3 PART 4 JAVA!!!! You have written the following Java program in a file called MyProgram.java: /** * My simple

PART 1PART 1PART 2PART 3PART 4JAVA!!!! You have written the following Java programPART 2in a file called MyProgram.java: /** * My simple Java program */PART 3class MyProgram { * Print different things based on command-line arguments *PART 4@param Command-line arguments public static void main(String[] args) { for(String arg :JAVA!!!!

You have written the following Java program in a file called MyProgram.java: /** * My simple Java program */ class MyProgram { * Print different things based on command-line arguments * @param Command-line arguments public static void main(String[] args) { for(String arg : args) { if(arg.equals("University")) { System.out.println("UCSD"); } else if(arg.equals("Department")) { System.out.println("CSE"); } else if(arg.equals("CourseNumber")) { System.out.println("11"); } else { System.out.println("Unknown"): TASK: At the Unix command line, assuming you have already compiled the program, what exact command would you need to run in order to have MyProgram print the following? CSE 11 UCSD TASK: Which of the following statements are true? (Select all that apply) Select all correct options from the list A method declared as final cannot be overridden The @Override tag is required to override a method O A superclass method is being overriden when a method definition with the exact same signature is written in a subclass O A method's return type is part of the method's signature A method's return type is part of the method's declaration Overloaded methods in a superclass can be overridden in a subclass TASK: Which of the following statements are true? (Select all that apply) Select all correct options from the list A non-static method in a superclass can be overloaded by a static method with the same signature in a subclass We can overload a method public void method(int x) by writing another method public int method(int y) in the same class O We can overload a method public void method(int x, int y) by writing another method public void method(int y, int x) in the same class We can overload a method public void method ( double x, int y) by writing another method public void method(int y, double x) in the same class O Overloaded methods can have different return types TASK: Write a public static method called readMessage that has a parameter of type String called filename. It should read the contents of the file with filename filename and return the resulting String EXAMPLE: If I had a file called message.txt with the following contents: Hello, World! Calling readMessage("message.txt") would return "Hello, World!" NOTE: I had to write my own hack-y FileReader class to avoid forcing you all to do more Linux challenges, so it only supports the FileReader(String fileName) constructor and the read() method (which reads a single character as an int that you can cast to char). If you try to use anything outside of these, it will break Sample Input: Hello, World! message.txt Sample Output: Hello, World

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!