Я не понимаю почему две абсолютно одинаковые строки не сходятся при проверка "Логина"(В profile.java).
Да, вопрос детский но всё же.
Console.java - основной класс
package com.app.console;
import java.util.Scanner;
public class Console{
public static void main(String[] args) throws InterruptedException {
boolean g = true;
boolean r = false;
profile prof = new profile();
Reg reg = new Reg();
GUI GUI = new GUI();
Scanner input = new Scanner(System.in);
while(g == true){
if(r == false){
GUI.menu_anon();
int ar = input.nextInt();
if(ar == 1){
GUI.loading();
Thread.sleep(2000);
reg.regist();
r = true;
if(ar == 2)g = false;
}
}
if(r == true){
GUI.menu();
int aa = input.nextInt();
if(aa == 1){
prof.entrance();
}
if(aa == 2)g = false;
}
}
}
}
GUI.java - графическая составляющая
package com.app.console;
public class GUI {
public static void menu_anon(){
System.out.println("|=====?MENU?=====|");
System.out.println("|1. Registration |");
System.out.println("|2. Exit |");
System.out.println("|================|");
System.out.println("");
}
public static void menu(){
System.out.println("|=====?MENU?=====|");
System.out.println("|1. Profile |");
System.out.println("|2. Exit |");
System.out.println("|================|");
System.out.println("");
}
public static void loading() throws InterruptedException {
System.out.print("Loading: <");
for(int i = 0; i < 21; i++){
Thread.sleep(100);
if(i != 20){
System.out.print('-');
}
else{
System.out.println('>');
System.out.println("");
}
}
}
}
profile.java - профиль человека
package com.app.console;
import java.util.Scanner;
public class profile extends data{
public static void entrance(){
Scanner input = new Scanner(System.in);
System.out.println("/=====?ENTRANCE?=====/");
System.out.print("|Login: ");
String log = input.nextLine();
System.out.print("|Passworld: ");
int pass = input.nextInt();
check(log, pass);
}
public static void check(String a, int b){
//System.out.println('|'+a+'|'+'|'+login+'|'+'|'+b+'|'+'|'+passworld+'|');
if(a != login){
System.out.println("!ERROR login!");
System.out.println("");
}
if(b != passworld){
System.out.println("!ERROR passwolrd!");
System.out.println("");
}
if(a == login){
if(b == passworld){
System.out.println("s");
}
}
}
}
Reg.java - регистрация.
package com.app.console;
import java.util.Scanner;
public class Reg extends data{
public static void regist(){
Scanner input = new Scanner(System.in);
System.out.println("|=====?REGISTRATION?=====|");
System.out.print("|Name: ");
name = input.nextLine();
System.out.print("|Login: ");
login = input.nextLine();
System.out.print("|Age: ");
age = input.nextInt();
System.out.print("|Passworld: ");
passworld = input.nextInt();
System.out.println("|========================|");
System.out.println("");
}
}
data.java - база данных
package com.app.console;
public class data {
public static String name, login;
public static int age, passworld;
}