Solved

missing import

Posted on 2004-04-09
4
232 Views
Last Modified: 2010-03-31
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
Comment
Question by:Ronayne
  • 2
4 Comments
 
LVL 13

Accepted Solution

by:
Webstorm earned 30 total points
ID: 10790897
You must put this method in a class:

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

}
0
 

Author Comment

by:Ronayne
ID: 10791018

Ah I see, thx
0
 
LVL 37

Expert Comment

by:zzynx
ID: 10791020
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
 
LVL 13

Expert Comment

by:Webstorm
ID: 10791299
:-)

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

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Configure a Bean in an XML file 4 42
ejb stateless example 2 18
pagenation logic how it is working in my code 1 53
java mysql insert application 14 25
For customizing the look of your lightweight component and making it look opaque like it was made of plastic.  This tip assumes your component to be of rectangular shape and completely opaque.   (CODE)
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question