java - using classes and objects creating a createID -


i need project im doing. asks me to, "prompt , read user's first name , last name (separately). print string composed of first letter of user's first name, followed first 5 characters of user's last name. assume last name @ least 5 letters long". how correct errors , have desired output test 1? also, doing wrong?test 1 desired output[test 2 desired output]1 output

   class createid {  public static void main(string[] args) {     // todo auto-generated method stub   string id=("clare");   string ids1, ids2, ids3;     ids1=id.concat(" johnson");   system.out.println(ids1);   ids2=id.substring(0,6-10);  } 

}

to begin with, first , last name of user. can use java.util.scanner class easily.

assuming first , last names stored in string variables firstname , lastname, use firstname.substring(0, 1) first character in first name. first 5 characters of users last name, use lastname.substring(0, 5) final result concatenation of these results, can obtained using + operator.


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -