Current location - Education and Training Encyclopedia - Education and training - How to Input Java Input in Huawei Computer Test? Do you want to enter it from the console?
How to Input Java Input in Huawei Computer Test? Do you want to enter it from the console?
If you don't need to make an interface, it's console input and output. Of course, you need a scanner for console input.

Scanner s = new scanner (system. in);

System.out.println ("Please enter string length:");

int len 1 = s . nextint();

System.out.println ("Please enter a string:");

string str 1 = s . next line();

System.out.println ("Please enter string length:");

int len 2 = s . nextint();

System.out.println ("Please enter a string:");