I have three classes Client,Product and Main.How can I call the client and the product from the main ?
Tuz
0
Newbie Poster
Recommended Answers
Jump to PostIn java, all you need to do is reference them from main.
...just like you would reference almost any other class.
...unless they are buried in some other package.Are they in separate files?
Jump to PostA couple of things you should know:
1) When you post code, please use the [ CODE ] button at the top edge of the post and put your code in the tags so it displays in a better format.
2) Only ONE of your classes can have a main() …
Jump to PostAnd
3) Learn to indent.
Jump to PostWe're getting there.
Let's say you remove the main from your Product class and arrange it like this:import java.util.*; import java.text.*; public class Product { private String code; private String description; private double price; public Product() { code=""; description=""; price=0.0; } public Product(Product copy) { this.code=copy.code; …
All 14 Replies
thines01
401
Postaholic
Team Colleague
Featured Poster
Tuz
0
Newbie Poster
thines01
401
Postaholic
Team Colleague
Featured Poster
Ezzaral
2,714
Posting Sage
Team Colleague
Featured Poster
Tuz
0
Newbie Poster
Tuz
0
Newbie Poster
thines01
401
Postaholic
Team Colleague
Featured Poster
Tuz
0
Newbie Poster
Tuz
0
Newbie Poster
Tuz
0
Newbie Poster
thines01
401
Postaholic
Team Colleague
Featured Poster
Tuz
0
Newbie Poster
thines01
401
Postaholic
Team Colleague
Featured Poster
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.