wood burning stoves 2.0*
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 Murach's Java Servlets and JSP this week in the Servlets 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!!!
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
subject: Problem in the code
Similar Threads
Need Servlets 4a Help
dates and times as integers in a query string
Creating array of objects from user input and saving to a file
Analizing Dates for Calculation
Finding number of days in a month confusion