+ 1

Creating username

What is wrong with my code? I'm looking to create a username based on my name and surname and random numbers. https://code.sololearn.com/cnDtzfYd8Cjp/?ref=app

11th Dec 2018, 2:22 PM
Sibusiso Mbambo
4 Answers
+ 4
import java.util.Random; import java.util.*; // your mistake, java.util* public class MyUsername{ public static void main(String[] args) { String first = "emma"; String last = "mbambo"; Random genarate = new Random(); int myNumber = genarate.nextInt(70) + 11; String username = first.charAt(0) + last.substring(0, 5) + myNumber; // Your mistake, put declaration of username first. System.out.println(username); } }
11th Dec 2018, 2:32 PM
ShortCode
+ 2
ShortCode Thanks
11th Dec 2018, 2:36 PM
Sibusiso Mbambo
+ 2
Rstar great job!
11th Dec 2018, 2:39 PM
Sibusiso Mbambo