Create a new Java class with a main() method that displays "Hello World!" followed by a new line with your name on it. The final printout should look like:
Hello, World!
by <your name here>
Remember to follow Java standard conventions by giving the class and file name the same name, such as "public class HelloWorld" and HelloWorld.java. By giving the file name the same name as your class name, the Java executable will know what compiled class name to look for the after you compile the file named "HelloWorld.java".
Make sure you create your Java Project, create your Java class and run / execute this
Trending nowThis is a popular solution!
Step by stepSolved in 4 steps with 2 images
- Java Questions - (Has 2 Parts). Based on each code, which answer out of the choices "A,B,C,D,E" is correct. Each question has one correct answer. Thank you. Part 1 - 3. Assume that "cal" is an instance of the java.util.Calendar class, which can return the current time of this Calendar in Milliseconds? A. System.out.println(cal.getTime());B. System.out.println(cal.getTimeInMillis());C. System.out.println(cal.getMillis());D. System.out.println(cal.getMillisTime());E. System.out.println(cal.getTimeMillis()); Part 2 - 4. Assume that "cal" is an instance of the java.util.Calendar class, which can set the month to February? A. cal.set(Calendar.MONTH, 1);B. cal.set(Calendar.MONTH, 2);C. cal.set(Calendar.MONTH, 3);D. cal.set(Calendar.MONTH, Feb);E. cal.set(Calendar.MONTH, February);arrow_forwardWrite a class in java with the name AgeMessages, which does the following: a. Ask the user to enter age using a Scanner b. If the age is less than 13, print: "too young to create a Facebook account" c. If the age is less than 16, print: "too young to get a driver's license" d. If the age is less than 18, print: "too young to get a tattoo" e. If the age is less than 21, print: "too young to drink alcohol" f. If the age is less than 35, print: "too young to run for President of the U.S." and on next line print: "(How sad!)" g. If the age is greater and equal to 35, print: "able to do anything" and on next line print: "(How happy!)" Tips | Use only an if statement Copy and paste your code | Screen shot the console with user input of 2 | Screen shot the console with user input of 18 | Screen shot the console with user input of 91arrow_forwardPlease teach me how to fix an error from my JAVA source code. I have set up the source code with class name "ProductionWorker" and there were a error occured on second page of sceenshot where it is highlighted. //import the file import java.util.*; //create the class class Employee { //create the variable private String emp_num; //create the date variable private Date hiring_date; // default constructor public Employee() { //assign the emp num. this.emp_num = "000-A"; //assign the Date this.hiring_date = new Date(); } // constructor parameter public Employee(String emp_num, Date hiring_date) { this.emp_num = emp_num; this.hiring_date = hiring_date; } // getter method public String getEmployeeNumber() { return this.emp_num; } // call the gethiringdate function public Date gethiringDate() { // return the date return this.hiring_date; } // setter method public void setEmployeeNumber(String emp_num) { //set the emp num. this.emp_num = emp_num; } //set the hiring date public void…arrow_forward
- When comparing two objects using the equals method inherited from the Object class, what is actually compared is the contents of the objects in java. True or Falsearrow_forwardWrite a class that instantiates a Scanner object and asks the user for their grade, represented by an integer, and then full name, represented by a String, (in that order specifically) on separate lines, and then prints it a string in the format given below with the user input printed. The output should look like below, with bold text in brackets representing user input. Grade: [11] Name: [John Smith] Welcome John Smith, you are in grade 11!arrow_forwardFor JAVAarrow_forward
- 2. Modify the Fahrenheit program so that it displays a button that when pressed causes theconversion calculation to take place. The user will have the option of pressing Enter inthe text field or pressing the button. Have the listener that is already defined for the textfield also listen for the button push.arrow_forwardHow do I write this in Java programming using Scanner class? There are 12 inches in a foot and 3 feet in a yard. Create a class named InchConversion. Its main() method accepts a value in inches from a user at the keyboard, and in turn passes the entered value to two methods. One converts the value from inches to feet, and the other converts the same value from inches to yards. Each method displays the results with appropriate explanation. This is what it starts with: import java.util.Scanner; public class InchConversion { public static void main (String args[]) { //Enter code here } public static void convertToFeet(int inches) { //Enter code here }public static void convertToYards(int inches) { //Enter code herearrow_forwardIn Java please. Only aswer the code where it says "/* Your code goes here */". Write a method lastNameFirst that takes a string containing a name such as "Harry Smith" or "Mary Jane Lee", and that returns the string with the last name first, such as "Smith, Harry" or "Lee, Mary Jane". import java.util.Scanner; public class Names{ /** Changes a name so that the last name comes first. If name has no spaces, it is returned without change. @param name a name such as "Mary Jane Lee" @return the reversed name, such as "Lee, Mary Jane". */ public static String lastNameFirst(String name) { /* Your code goes here */ } public static void main(String[] args) { Scanner in = new Scanner(System.in); String name = in.nextLine(); System.out.println(lastNameFirst(name)); }}arrow_forward
- Computer Networking: A Top-Down Approach (7th Edi...Computer EngineeringISBN:9780133594140Author:James Kurose, Keith RossPublisher:PEARSONComputer Organization and Design MIPS Edition, Fi...Computer EngineeringISBN:9780124077263Author:David A. Patterson, John L. HennessyPublisher:Elsevier ScienceNetwork+ Guide to Networks (MindTap Course List)Computer EngineeringISBN:9781337569330Author:Jill West, Tamara Dean, Jean AndrewsPublisher:Cengage Learning
- Concepts of Database ManagementComputer EngineeringISBN:9781337093422Author:Joy L. Starks, Philip J. Pratt, Mary Z. LastPublisher:Cengage LearningPrelude to ProgrammingComputer EngineeringISBN:9780133750423Author:VENIT, StewartPublisher:Pearson EducationSc Business Data Communications and Networking, T...Computer EngineeringISBN:9781119368830Author:FITZGERALDPublisher:WILEY