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

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

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!! :)

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.