Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cannot run Javas samples in J Builder6

Status
Not open for further replies.

DGA15

Programmer
Aug 19, 2000
40
US
I am a Java newbie,using JBuilder6
While I can create some simple Java prograams myself,I cannot run Java from other sources. For example:

//from "Thinking in Java",page #120

package hellodate;

import java.util.*;

public class HelloDate {
public static void main(String[] args) {
System.out.println("Hello, it's ");
System.out.println(new Date());
}
}
//gives the following error
//"Untitled1.java": Error #: 475 : class HelloDate is public; must be declared in a file named HelloDate.java at line 7, column 8

I obviously don't understandsomething about the structure.
Can you advise me?
In other samples, the code
System.out.println("some string");
ran w/o error but no output appeared on the screen.

 
public classes must be declared in a file of the same name.

E.g.

public class HelloDate
{
...
}

must be in a file called HelloDate.java
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top