Skip to content

Latest commit

 

History

History
33 lines (24 loc) · 861 Bytes

File metadata and controls

33 lines (24 loc) · 861 Bytes

Java Echo Example

This is a simple Java program that reads input from the user and echoes it back.

How It Works

  • The program uses a Scanner to read user input.
  • It then prints that input back with the prefix "Echo:".

How to Run

You can run this code using any Java compiler. Here's a quick way using an online compiler:

Run it Online

💻 Sample Code

import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
      Scanner scanner = new Scanner(System.in);
      System.out.print("Enter text: ");
      String input = scanner.nextLine();
      System.out.println("Echo: " + input);
  }
}