File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

cannot create new object of a class

 
Ziyoda Mirkhonova
Greenhorn
Posts: 10
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone,
I am now learning classes and methods. I have problems with calling new object as instance of a class. Look at this:

University canteen wants to have a computer based system. They want to have a computer program that will allow them to order food and carry out transactions.
The manager should be able to order pies and somosas and pay for them using this program.
She/he(manager) will also be able to sell these goods to students with this new system.

And I programmed like this:



As you see wouldn't work!
Also, I tried to save different classes in different files, but I encountered same problem.

I will be happy to receive your help. Sorry for taking your time and energy!
 
satishkumar janakiraman
Ranch Hand
Posts: 334
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Please check the code. I didnt change your business logic, I just changed few lines.



bye for now
sat
 
Shaan Shar
Ranch Hand
Posts: 1249
Java Spring Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think that the question should be closed now. Because second code is running fine.
 
Ziyoda Mirkhonova
Greenhorn
Posts: 10
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, Satishkumar Janakiraman,
thanks for corrections!!! Stop, don't lock this. It works, but I don't understand one thing.
1) Why did you do extends?


Does it mean that first, you create many classes and the last of them must be public? When you say extends it means, one class IN the other?

2) Also, does it mean that you cannot use any static when you have a lot of classes?

Thanks once more!!!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic