subject

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.");
}
}
}

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 00:10
Write a function so that the main0 code below can be replaced by the simpler code that calls function mphandminutes tomiles0. original main0 int main) l double milesperhour-70.0; double minutestraveled = 100.0; double hourstraveled; double milestraveled; hourstraveled = minutestraveled / 60.0; milestraveled = hourstraveled * milesperhour; cout < "miles" 2 using namespace std; 4 /* your solution goes here/ 6 int maino 1 test passed 7 double milesperhour 70.0 all tests passed 8 double minutestraveled 100.0; 10 cout < < "miles: " < < mphandminutestomiles(milesper-hour, minutestraveled) < < endl; 12 return 0; 13
Answers: 1
question
Computers and Technology, 23.06.2019 03:50
Q-1 which of the following can exist as cloud-based it resources? a. physical serverb. virtual serverc. software programd. network device
Answers: 1
question
Computers and Technology, 23.06.2019 04:31
Acloud service provider uses the internet to deliver a computing environment for developing, running, and managing software applications. which cloud service model does the provider offer? a. iaas b. caas c. maas d. paas e. saas
Answers: 1
question
Computers and Technology, 23.06.2019 16:00
An english teacher would like to divide 8 boys and 10 girls into groups, each with the same combination of boys and girls and nobody left out. what is the greatest number of groups that can be formed?
Answers: 2
You know the right answer?
First, launch NetBeans and close any previous projects that may be open (at the top menu go to File...
Questions
question
English, 12.09.2021 04:10
question
Mathematics, 12.09.2021 04:10
question
Mathematics, 12.09.2021 04:10
question
Mathematics, 12.09.2021 04:10
question
Mathematics, 12.09.2021 04:10
Questions on the website: 13722359