+ 2
please make me know what is the problem of following code
//Identify words and numbers import java.utl.Scanner; class a { int g; private void character (String g){ g = sc; sc = nextLine(); System.out.println("string"); } } class b { int f; private void number (Integer f){ f = sc; sc = nextInt(); System.out.println("number"); } } public static void main (String[]args){ Scanner sc = new Scanner(System.in); a Scanner sc = new a(); (nextLine()).character(); b Scanner sc = new b(); (nextInt()).number(); }
3 Respuestas
+ 6
Is this what you had in mind?
https://code.sololearn.com/c9IjBj47OgVC/?ref=app
+ 5
I see that this is JAVA, but where did you learn to program?
first line utl should be util
a Scanner sc = new a();
//???????????????? HOW AND WHY?
When you Initialize a new instance you'll need to assign it to a variable like this:
a myA = new a();
same with the other few lines in the Main function.
The classes are just wrong.
Are you mixing Java with Python?
Please do the courses again, I'll see what I can do around this code of yours
+ 2
thank you