Results 1 to 10 of 10
- 11-22-2008, 06:55 AM #1
Error: LengthCharAt.java:3: ';' expected public static void main (String[] args)
I keep getting this error for the code below:
LengthCharAt.java:3: ';' expected public static void main (String[] args)
What am I doing wrong?
Thanks.
public class LengthCharAt
{
public static void main (String[] args)
private static void StringMethod()
{
String stringVariable = new String("helo");
String[ ] stringArray = {"abcd", "f", "wxy", "kl"};
stringVariable=stringVariable.charAt
(stringArray[3].length()) + stringVariable;
System.out.println(stringVariable);
}
}"The minute you settle for less than you deserve, you get even less than you settled for." Maureen Dowd
- 11-22-2008, 07:11 AM #2
You cannot declare one method in another,as you did.
- 11-22-2008, 07:27 AM #3
so how could this code work? thanks.
"The minute you settle for less than you deserve, you get even less than you settled for." Maureen Dowd
- 11-22-2008, 08:33 AM #4
Java Code:public class LengthCharAt { public static void StringMethod() { String stringVariable = new String("helo"); String[ ] stringArray = {"abcd", "f", "wxy", "kl"}; stringVariable=stringVariable.charAt(stringArray[3].length())+stringVariable; System.out.println(stringVariable); } public static void main (String[] args) { new LengthChartAt().StringMethod(); } }
- 11-22-2008, 10:12 PM #5
I keep getting error for line 12: java:12: cannot find symbol
symbol : class LengthChartAt
location: class LengthCharAt
new LengthChartAt().StringMethod();
dunno... :("The minute you settle for less than you deserve, you get even less than you settled for." Maureen Dowd
- 11-22-2008, 10:23 PM #6
are you a java tutor or do you know any?
"The minute you settle for less than you deserve, you get even less than you settled for." Maureen Dowd
- 11-22-2008, 10:37 PM #7
there is an error,remove letter "t",the name of the class was pselled wrong
Java Code:new LengthCharAt().StringMethod();
- 11-22-2008, 10:55 PM #8
- 11-22-2008, 10:59 PM #9
if you teach java because I need help to pass an exam at the university. :)
"The minute you settle for less than you deserve, you get even less than you settled for." Maureen Dowd
- 11-22-2008, 11:03 PM #10
Similar Threads
-
Why can't we write main without String args[]
By shailender in forum New To JavaReplies: 4Last Post: 11-05-2008, 10:58 AM -
[SOLVED] Why main() in java is declared as public static void main?
By piyu.sha in forum New To JavaReplies: 5Last Post: 10-06-2008, 12:11 AM -
calling a public void method from a class button
By supa_kali_frajilistik in forum AWT / SwingReplies: 4Last Post: 05-23-2008, 01:05 PM -
The different of static void,protected,and void in methods?
By Winarto in forum New To JavaReplies: 5Last Post: 01-24-2008, 11:53 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks