aspose file tools*
The moose likes Beginning Java and the fly likes Problem in the code Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Problem in the code" Watch "Problem in the code" New topic

Problem in the code

Ganesh Kumar
Ranch Hand

Joined: Jul 02, 2007
Posts: 113
When i execute this code mon=08,mon=09 shows error. Can any one say me what is the problem here

int mon = 0;
else if(Month.equals("Feb"))
else if(Month.equals("Mar"))
else if(Month.equals("Apr"))
else if(Month.equals("May"))
else if(Month.equals("Jun"))
mon= 06;
else if(Month.equals("Jul"))
mon= 07;
else if(Month.equals("Aug"))
mon = 08;
else if(Month.equals("Sep"))
mon = 09;
else if(Month.equals("Oct"))
else if(Month.equals("Nov"))
else if(Month.equals("Dec"))
Anupam Sinha
Ranch Hand

Joined: Apr 13, 2003
Posts: 1088
When you prefix an integer with zero(0) it becomes an octal literal. Octals have a range from 0 - 7. Hence the error.
Ganesh Kumar
Ranch Hand

Joined: Jul 02, 2007
Posts: 113
Thank you Anupam!!!
I agree. Here's the link:
subject: Problem in the code
Similar Threads
Finding number of days in a month confusion
dates and times as integers in a query string
Need Servlets 4a Help
Creating array of objects from user input and saving to a file
Analizing Dates for Calculation