0

I am working on a simple "test 123" java program
for a RoboJDE robot.

I keep getting a semantic error when I compile.
The error reads
***semantic error: "private" is not a valid modifier for al ocal variable***
***semantic error: "staict" is not a valid modifier for a local variable***

My code is:

import com.ridgesoft.intellibrain.IntelliBrain;
public class test{
public static void main (String args[]) {
[B]private static String myName ="testing 123";[/B]
System.out.println(myName);
         }
}

I copied it directly from a working project and just changed some of the
wording.

I can't figure it out.
Any ideas would be extremely helpful!!!

Thanks in advance!!

COY

2
Contributors
3
Replies
4
Views
8 Years
Discussion Span
Last Post by Coyboss
0

if you want to declare the variable private(,public,protected) and static, you must declare it for the class, not inside a method

try this:

import com.ridgesoft.intellibrain.IntelliBrain;
public class test{
private static String myName = "testing 123";
public static void main (String args[]) {
System.out.println(myName);
         }
}

I am working on a simple "test 123" java program
for a RoboJDE robot.

I keep getting a semantic error when I compile.
The error reads
***semantic error: "private" is not a valid modifier for al ocal variable***
***semantic error: "staict" is not a valid modifier for a local variable***

My code is:

import com.ridgesoft.intellibrain.IntelliBrain;
public class test{
public static void main (String args[]) {
[B]private static String myName ="testing 123";[/B]
System.out.println(myName);
         }
}

I copied it directly from a working project and just changed some of the
wording.

I can't figure it out.
Any ideas would be extremely helpful!!!

Thanks in advance!!

COY

0

Ahhh I didn't realize I had it in the wrong place!!
I have a Compile time error message glossary, but it didn't have this error in it!

Thanks for the help!
It works now!! :)

0

I am glad I found a place to go for help with this!!
I am using the RoboJDE robot in my Adv Tech II class to try and teach my students a little about programming!!

Its nice to have a quick resource to fall back on.!!

COY

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.