Edit the following java files, compile, and execute the bytecodes. /** * Title:
ID: 3624798 • Letter: E
Question
Edit the following java files, compile, and execute the bytecodes./**
* Title: Test123
* Description: test System.out.println() method
* Copyright: Copyright (c) 2002
* Company: CIS3330 Spring02
* @author changm
* @version 1.0
*/
import java.io.*;
public class Test123 {
public static void main(String args[]){
String str;
byte[] testBytes = new byte[100];
int iNumberOfBytes;
System.out.print("Please enter a number:");
try {
iNumberOfBytes=System.in.read(testBytes);
str = new String(testBytes);
System.out.println(str);
}
catch (IOException e){}
}
}
Step 1 - Add the following comments:
File: fileName (Example Test333.java)
Date: mm/dd/yyyy
Name: yourFirstName yourLastName
Assignment: 1
Compile the file and then execute the compiled file.
Step 2 - Modify the public class name Test123 to yourLastName
Make sure you save it to the right file name accordingly
Compile the modified file and then execute the compiled file.
Explanation / Answer
import java.io.*; public class Test123 { public static void main(String args[]){ String str; byte[] testBytes = new byte[100]; int iNumberOfBytes; System.out.print("Please enter a number: "); try { iNumberOfBytes=System.in.read(testBytes); str = new String(testBytes); System.out.println(str); } catch (IOException e){} } }
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.