008-002-002

Method Usage: String Length

Medium

Problem Description

In this problem, you will create a program that receives a string, obtains its character count using the length() method, and displays the result to standard output.

String Methods

Use length() method to get string length.

Test Cases

※ Output examples follow programming industry standards

Normal case
Input:
Hello
Expected Output:
Text: Hello
Length: 5
Normal case
Input:
Java Programming
Expected Output:
Text: Java Programming
Length: 16

Your Solution

Current Mode: My Code
import java.util.Scanner;

public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
// Write your code here

sc.close();
}
}
0 B / 5 MB

You have 10 free executions remaining