Computers and Technology

First, launch NetBeans and close any previous projects that may be open (at the top menu go to File ==> Close All Projects).

Then, create a new Java application called "StringLength" (without the quotation marks) that requests a String from the user at the command line and finds its length. Your program should output: "Your string has a length of X characters." where X is the String's length. Allow for the String to be one or more words of input. Be sure to use the suitable method for determining the length of the String.

I have the below code but it is only giving me the output that "Your string has a length of x characters". it is not outputting that Hello, my name is John Smith.

package stringlength;

import java. util. Scanner;

public class StringLength
{

public static void main(String[] args) {
if(args. length > -1) {

String input = args[0];

int length = input. length(); // using length() method in String class
System. out. println("Your string has a length of "+length+" characters.");

System. out. println("Your string has a length of "+length+" characters.");
}
}
}

answer
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 17:40, math31343
Gabe wants to move text from one document to another document. he should copy the text, paste the text, and open the new document highlight the text, select the cut command, move to the new document, make sure the cursor is in the correct location, and select the paste command select the save as command, navigate to the new document, and click save highlight the text, open the new document, and press ctrl and v
Answers: 1
image
Computers and Technology, 23.06.2019 20:30, maryanapritchak1829
If chris has a car liability insurance, what damage would he be covered for
Answers: 1
image
Computers and Technology, 24.06.2019 12:30, nomood
Select all that apply. what two keys listed below should you use to enter data in an excel worksheet? tab backspace enter right arrow
Answers: 2
image
Computers and Technology, 24.06.2019 13:00, NycLife
Why should you evaluate trends when thinking about a career path?
Answers: 1
Do you know the correct answer?
First, launch NetBeans and close any previous projects that may be open (at the top menu go to File...

Questions in other subjects:

Konu
History, 13.11.2020 19:50
Konu
Mathematics, 13.11.2020 19:50