java/labs/lab2/Errors.java
2024-10-23 15:11:20 +03:00

20 lines
595 B
Java

// File: Errors.java
// Purpose: A program with lots of syntax errors
// Correct all of the errors (STUDY the program carefully!!)
import java.util.Scanner;
public class Errors
{
public static void main (String[] args)
{
String Name; // Name of the user
int number;
int numSq;
Scanner scan = new Scanner(System.in);
System.out.println ("Enter your name, please: ");
Name = scan.nextLine();
System.out.println ("What is your favorite number?");
number = scan.nextInt();
numSq = number * number;
System.out.println (Name+", the square of your number is " + numSq);
}
}