Solved

missing import

Posted on 2004-04-09
4
228 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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Fibonacci challenge 11 84
array220 challenge 8 48
nestparen challenge 4 57
create a gui in perl 3 46
For customizing the look of your lightweight component and making it look lucid like it was made of glass. Or: how to make your component more Apple-ish ;) This tip assumes your component to be of rectangular shape and completely opaque. (COD…
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

746 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now