funny little program has a error.help
Posted: Wed Aug 11, 2010 12:06 am
This funny program made by me & it has no errors.but I need to develop it.I try to get that mobile number with the first ZERO.but it has error..
This got a error like this..
I think that if I change y variable type..will it correct?
Then I changed it like this..
Code: Select all
import java.util.Scanner;
/*
*created by Gayan Bandara
*date-2010.Aug.10 night
*this is too check the friendship
*Think the phone number is 0712346578
*/
class do_you_know_gayan{
public static void main(String args[]){
Scanner gayan = new Scanner(System.in);
double phone;
System.out.println("This programm will check the friendship with Gayan & you..");
System.out.println("Get ready.....Now");
System.out.println("Enter Gayan's mobile number :-");
phone = gayan.nextDouble();
if (phone ==0712345678){
System.out.println("you know him");
}else{
System.out.println("you don't know him");
}
}
}
/*
* tested Gayan Bandara.
*/
Code: Select all
>javac do_you_know_gayan.java
do_you_know_gayan.java:22: integer number too large: 0712345678
if (phone ==0712345678){
^
1 error
>Exit code: 1
Then I changed it like this..
Code: Select all
import java.util.Scanner;
/*
*created by Gayan Bandara
*date-2010.Aug.10 night
*this is too check the friendship
*Think the phone number is 0712346578
*/
class do_you_know_gayan{
public static void main(String args[]){
Scanner gayan = new Scanner(System.in);
double phone;
System.out.println("This programm will check the friendship with Gayan & you..");
System.out.println("Get ready.....Now");
System.out.println("Enter Gayan's mobile number with out first '0'of the phone number:-");
phone = gayan.nextDouble();
//trying to get the full number like this 0712345678..but :(
if (phone ==712345678){
System.out.println("you know him");
}else{
System.out.println("you don't know him");
}
}
}
/*
* tested Gayan Bandara.
*/