• Post Reply Bookmark Topic Watch Topic
  • New Topic

Problem In Running Code  RSS feed

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello everyone, I am fairly new to this forum and i am having a problem in Running a programme that i created while learning Java.
This consists of 2 classes with one having objects from another one(OF COURSE). Here is the problem- :

Class with object attributes, Methods and scanner



The class with Objects which is not running the code above


Help would be sincerely appreciated.
 
Rancher
Posts: 2240
28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
having a problem in Running a programme

Can you explain what you are doing that gives you a problem?

Is the problem with the compilation or execution of your program?
If so, please copy the full text of the error message and paste it here.

Or is the problem with the IDE you are using?
 
Saloon Keeper
Posts: 3330
46
Eclipse IDE Firefox Browser Java MySQL Database VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Fields text, line, and num should be moved to the methods where they are used, in which case they become local variables and not fields.

There is a naming convention for getters:

You have methods using this name but they are not truly getters but method to prompt users for input. I would suggest renaming them to something like inputXXX() or promptXXX().
 
Carey Brown
Saloon Keeper
Posts: 3330
46
Eclipse IDE Firefox Browser Java MySQL Database VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In this method

you get user input into the line variable but then throw it away. Which do you want assigned to the field called "name", the argument called "name", or the user input from "line"?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!