public static void main(String argv[]){
String a="0700";
Scanner s = new Scanner(a);
while(s.hasNextLong()){
System.out.print(s.nextLong()+",");
}
Result will be “700,” not the “448”.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
By default the scanner assumes that the number is in base 10 and will ignore the leading 0s. You can specify another radix if you want – the code below prints 448: