0
why is it not working?
import java.util.Scanner; public class Program { public static void main(String[] args) { Scanner scan = new Scanner (System.in); String x = scan.nextLine(); char y = scan.nextChar(); Shirt s = new Shirt(x, y); System.out.println ("Color: " + s.color); System.out.println ("Size: " + s.size); } } public class Shirt{ String color; char size; Shirt (String color, char size){ this.color = color; this.size = size; } }
8 Respuestas
+ 3
char y = scan.next().charAt(0);
You cannot input char like that ,read more
https://www.google.com/amp/s/www.geeksforgeeks.org/gfact-51-java-scanner-nextchar/amp/
+ 1
Martin Taylor thank you!
0
https://code.sololearn.com/c1L9gm0YYiws/?ref=app
Abhay still doesn't work
0
https://code.sololearn.com/c1L9gm0YYiws/?ref=app
Martin Taylor thank you! But now I have an Expectation... is it okay but Sololearn can't run it?
0
Martin Taylor so I just need to remove the "pubic" from the shirt class and then everything should be fine?