So whenever I build and test my maven package i am not getting an output and the program auto closes, I have tried this on Eclipse and Netbeans and still no heed, thanks in advance and the code is below:
public static void main(String[] args) {
// TODO Auto-generated method stub
Boolean end = false;
while(end = false){
System.out.println("Enter your command(for list of commands press h): ");
Scanner scanner = new Scanner(System.in);
String command = scanner.nextLine();
if(command == "h"){
System.out.println("start starts basic program");
System.out.println("start1 starts twitter based program(in development)");
System.out.println("api sets api");
System.out.println("time sets check time");
}else if( command == "start"){
mainmethod();
}else if(command == "time"){
}else if( command == "end"){
end = true;
}
}
}
2
Answers
your code means:
Please change from:
into:
It’s “==” rather than “=”.end == false