saw your java tutorial and tries something, but having a problem

0 Aditya Jindal · September 6, 2015
package Bucky;

import java.util.Scanner;

public class apples111z {
public static void main (String args[]){
Scanner bucky = new Scanner (System.in);
int boy, girl;
System.out.println("Enter the age of the boy ");
boy = bucky.nextInt();
System.out.println("Enter the age of the girl");
girl = bucky.nextInt();

if ( boy <= 18 && girl >= 60){
System.out.println("Not a suitable match");
}else{
System.out.println("you may make a match");
}

}

}


on entering the age of the boy as 10
and entering the age of the girl as 90
it is printing you may make a match, which is the else statement, whereas it should print the IF statement.

plz help.

P:S, thank you Bucky for all these videos.

Post a Reply

Replies

Oldest  Newest  Rating
0 Alan Masimba Walker · September 7, 2015
I tried executing your code, and I didn't get an error.
0 rajeev man dongol · September 8, 2015
class name and file name must be same.
  • 1

Java / Android Development

107,080 followers
About

Very popular language used to create desktop applications, website applets, and Android apps.

Links
Moderators
Bucky Roberts Administrator