Question: Task As we have pointed out Java programs are text files. As strange as it may seem, the following is a completely legal Java program.

 Task As we have pointed out Java programs are text files.

Task As we have pointed out Java programs are text files. As strange as it may seem, the following is a completely legal Java program. It consists of only the printable characters "", "u", and the hex digits "O" through "F", and the newline indications! Newline cannot appear just anywhere in a Java program. (They cannot appear in the middle of an identifier, for example) \u0070\u0075\u0062\u006c\u0069\U0063\u0020\u0020\u0020\u0020 \u0063\u006c\u0061\u0073\u0073\u0020\u0055\u0067\u006c\u0079 \u007b\u0070\u0075\u0062\u006c\u0069\u0063\u0020\u0020\u0020 \u0020\u0020\u0020\u0020\u0073\u0074\U0061\u0074\u0069\u0063 \u0076\u00f\u0069\u0064\u0020\u00d\u0061\u0069\u006e\u0028 \u0053\u0074\u0072\u0069\u006e\u0067\u005b\u005d\u0020\u0020 \u0020\u0020\u0020\u0020\u0061\u0072\u0067\u0073\u0029\u007b \u0053\u0079\u0073\u0074\u0065\u00bd\u002e\u00f\u0075\u0074 \u002e\u0070\u0072\u0069\u006e\u0074\u006c\u006e\u0028\u0020 \u0022\u0048\u0065\u006c\u006c\u00f\u0020\u0077\u0022\u0026 \u0022\u00f\u0072\u006c\u0064\u0022\u0029\u003b\u003d\u007d Using any text editor, create a text file named Ugly.java with the contents exactly as above. How many bytes does your file have? (It should have 671 or 682 bytes. Do not forget to end the last line with a line terminator mark.) (What character set is your file written in?) Using the command prompt, compile the file with 'javac' and run the program. What does the 'javac' program do? Execute the program. What does the mystery program do? Can you write a Java program that does the same thing? # javac Ugly.java java class-name What is the output of the program 'Ugly.java'? Capture the exact output in a file output.txt, save it to submit later. Try to figure out what the mysterious program really does by examining the output of 'javap -c'. The program 'javap' produces a representation of any Java class in text. What is the name of the Java class in the mysterious program? Using 'javap' we can reverse engineering the program, and guess what the program does. Capture the 'javap -c' representation of the Java class in a file, call it code.txt and TURN IT IN. The mysterious program is not written in a way that is easily read. Can you write an identical program with better style? By identical program, we mean one that has essentially the same class file as the mysterious program, not just the same output behavior. Create your Java program, call it Main.java, run javap on it. If it has similar class files as the mysterious program, then TURN IT IN. Aside from the use of Unicode escapes, your program Main.java undoubtedly has many small differences when compared to the mysterious program. The three parts of this lab you need to submit are: Mystery output: output.txt Output of javap: code.txt Java program: Main.java Please use the file names exactly as given above, as this makes it easier for us to verify that you have fulfilled the lab requirements

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!