• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How do I extend a file?

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

I'm totally new to Java, but I have some experience in other languages so some of it transfers, but not much.

I'm currently attempting to resolve an issue I'm having with my code. It's an assignment, and it has three documents.

The error:

Main method not found in class CourseList, please define main method as: Public Static void main(string[] args)



Another Error:

15: error: cannot find symbol
if (course.courseID == id)
^
symbol: variable courseID
location: variable course of type Course
1 error

Tool completed with exit code 1



Main function is on another document. Now, what I gather is that it is looking for the content, but the other files are not linked (so to speak). From my research, they cannot be linked like they might have been in C++. I did find the extend bit, but I'm not really sure how that works.

Would it be included with a path name? Or is it just assuming the files are in the same location?

Document 1:


Document 2:


Document 3:

 
author
Posts: 23951
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

sierra mcgivney wrote:The error:

Main method not found in class CourseList, please define main method as: Public Static void main(string[] args)



You are trying to execute document 1 (the CourseList class) as you main entry point. And that class doesn't have a main() method.

Henry
 
sierra mcgivney
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Henry Wong wrote:

sierra mcgivney wrote:The error:

Main method not found in class CourseList, please define main method as: Public Static void main(string[] args)



You are trying to execute document 1 (the CourseList class) as you main entry point. And that class doesn't have a main() method.

Henry



Oh, thank you. That's remarkably silly. For some reason I had it in my head that you had to run it from that document. In any case, issue resolved.

But I do have a question I was hoping you could answer.

Does it automatically search files that are in the same directory folder?
 
Marshal
Posts: 4501
572
VSCode Eclipse IDE TypeScript Redhat MicroProfile Quarkus Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

sierra mcgivney wrote:15: error: cannot find symbol
if (course.courseID == id)
               ^
symbol: variable courseID
location: variable course of type Course


Your Course class doesn't have a field named courseID
 
Henry Wong
author
Posts: 23951
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

sierra mcgivney wrote:
Does it automatically search files that are in the same directory folder?



Have you learn packages yet? Have you learn about the classpath yet? We can't really answer your question until you understand those concepts first.... but assuming your current code, and you haven't set a classpath, then yes.

Henry
 
He loves you so much! And I'm baking the cake! I'm going to put this tiny ad in the cake:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic