Answer:
Here is code CarlysMotto.java
//import package
import java.util.*;
// class name
class CarlysMotto
{
// main method of class CarlysMotto
public static void main (String[] args) throws java.lang.Exception
{
try{
// string to hold the Carly's motto
String motto="Carly’s makes the food that makes it a party.";
System.out.println("Carly’s motto: ");
// print the motto
System.out.println(motto);
}catch(Exception ex){
return;}
}
}
Step-by-step explanation:
Create a class named "CarlysMotto".In the main method, create a strint that holds the motto.In the new line print "Carly’s motto:".After that print the string that holds Carly’s motto in newline.
Here is next code CarlysMotto2.java
//import package
import java.util.*;
// class name
class CarlysMotto2
{
// main method of class CarlysMotto
public static void main (String[] args) throws java.lang.Exception
{
try{
// string to hold the Carly's motto
String motto="Carly’s makes the food that makes it a party.";
System.out.println("Carly’s motto: ");
// this will print a line of asterisks(*) System.out.println("***********************************************************");
// print the motto
System.out.println(motto);
// this will print a line of asterisks(*) System.out.println("***********************************************************");
}catch(Exception ex){
return;}
}
}
Step-by-step explanation:
Create a class named "CarlysMotto".In the main method, create a strint that holds the motto.In the new line print "Carly’s motto:".Then print a line of asterisks (*).After that print the string that holds Carly’s motto in newline.After then print a line of asterisks(*).
Output:
Here is the output of both the program.