Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.*;
- public class Odds {
- public static void main(String[] args) {
- System.out.println("Zagrajmy w parzyste-nieparzyste!");
- System.out.print("Jak masz na imię ?");
- Scanner name = new Scanner(System.in);
- String imie = name.nextLine();
- readType(imie); // Tu jest błąd Error:(9, 9) java: non-static method readType(java.lang.String) cannot be referenced from a
- // static context
- }
- public void readType(String imie) {
- System.out.println("Cześć " + imie + " ! Co wybierasz, parzyste (P) czy nieparzyste (N)?");
- Scanner kind = new Scanner(System.in);
- String rodzaj = kind.nextLine();
- ;
- if (rodzaj.equals("P")) {
- System.out.print("Wybrałeś parzyste. Komputer będzie miał nieparzyste.");
- } else if (rodzaj.equals("N")) {
- System.out.print("Wybrałeś nieparzyste. Komputer będzie miał parzyste.");
- } else {
- readType(imie);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement