Win a copy of Pro Spring MVC with WebFlux: Web Development in Spring Framework 5 and Spring Boot 2 this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Rob Spoor
  • Bear Bibeault
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:
  • Frits Walraven
  • Himai Minh

import acm.graphics.*;

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I was seeing a tutorial on Java and they were able to run this program. But i have a few questions about this program:

import acm.graphics.*;
import acm.program.*;

public class Test extends GraphicsProgram{
public void run(){
add ( new GLabel ( "hello world", 100, 75));
}
}

I was told that a program needs to have the main method to start the program but this does not have any but it runs

and moreover i tried executing this program both on cmd line and on an eclipse, but it shows me that there are errors with the import statements,

So can any one explain me what's worng with the import statements.
 
Bartender
Posts: 3225
34
IntelliJ IDE Oracle Spring Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The program uses External Jars. So you would have to include them in your classpath or in the eclipse project.
 
Rancher
Posts: 1337
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I was told that a program needs to have the main method to start the program but this does not have any but it runs


The GraphicsProgram class probably has a main method which this class inherits. I say "probably" because you didn't mention how this class is intended to be used.
reply
    Bookmark Topic Watch Topic
  • New Topic