I know I'm probably being dumb here but I cannot seem to compile a java bean. Here is my code:

package beans;

import java.sql.*;

public class example
{
	public void test()
	{
		out.println("The bean worked");
	}

}

I get the error:

example.java:5: class Example is public, should b
ple.java
public class Example
^
example.java:9: cannot find symbol
symbol : variable out
location: class beans.Example
out.println("The bean worked");
^

Thanks for your help

Member Avatar for electron33
package beans;

import java.sql.*;

public class example
{
	public void test()
	{
                //Change to this an recompile
		System.out.println("The bean worked");
	}

}

> I know I'm probably being dumb here but I cannot seem to compile a java bean.

You are missing a static import in your package declaration. import static System.out;

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.