The Artima Developer Community
Sponsored Link

Java Answers Forum
illegal start of expresion

2 replies on 1 page. Most recent reply: Nov 12, 2002 9:10 AM by Dante T. Salvador

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 2 replies on 1 page
Tania

Posts: 1
Nickname: tazdevil
Registered: Nov, 2002

illegal start of expresion Posted: Nov 9, 2002 3:50 AM
Reply to this message Reply
Advertisement
just started learning java, aint got much of a clue, well none at all really

class ReadIn
{
public static void main(String[] args)
throws java.io.IOException
{

String inputString = null; // for storing the string with a null value if it doesn't exist
public int Gethour()
{
System.out.println("Please enter in the 24hr format the hour eg 00 - 23");
String hourstring; // for storing it as a string
int hourint = 0; // for storing the integer value
try
{
hourstring = Gethour();
hourInt = Integer.parseInt(hourString);
}
catch (NumberFormatException e)
{
System.out.println (e);
hourInt = 0;
}
return hourInt ;
}
}
}


any ideas why this doesnt work will be really appreciated


Ramu

Posts: 29
Nickname: sripoorna
Registered: Oct, 2002

Re: illegal start of expresion Posted: Nov 10, 2002 7:25 PM
Reply to this message Reply
hi
u r GetHour() method is in the main method that's why u r getting that exception.
In java one method should not contain another method

regards
ramu

Dante T. Salvador

Posts: 19
Nickname: anteng
Registered: Nov, 2002

Re: illegal start of expresion Posted: Nov 12, 2002 9:10 AM
Reply to this message Reply
can you tell me what is the purpose of this program?

Flat View: This topic has 2 replies on 1 page
Topic: IO streams....pl. help me....going to meet the deadline... Previous Topic   Next Topic Topic: help with creating a new fixed length file

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use