• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 245
  • Last Modified:

missing import

Hi, im getting this error for a java file, is there something extra I need to import?
Cheers


--------------------Configuration: j2sdk1.4.0_02 <Default>--------------------
C:\output.java:5: 'class' or 'interface' expected
public String output() {
       ^
1 error

Process completed.

0
Ronayne
Asked:
Ronayne
  • 2
1 Solution
 
WebstormCommented:
You must put this method in a class:

public class MyClass {
  public String output() { ... }

}
0
 
RonayneAuthor Commented:

Ah I see, thx
0
 
zzynxSoftware engineerCommented:
In your case:

public class Output {

  public Output() { // constructor of your Output class
  }

  public String output() {
     String t = "something";  // as an example
     return t;
  }

}
0
 
WebstormCommented:
:-)

If you want to learn more about Java :
http://java.sun.com/docs/books/tutorial/index.html
0

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now