Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within OCPJP
Search Coderanch
Advance search
Google search
Register / Login
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
Forum:
Programmer Certification (OCPJP)
constructor
radhika ayirala
Greenhorn
Posts: 24
posted 16 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
public class
test
{
public static void main(
String
[] args )
{
new test();
}
test()
{
test(2);
}
test(int x)
{
System.out.println(x);
}
}
why is this giving an error?
Chang Tzu-yu
Greenhorn
Posts: 16
posted 16 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Call Constructor must use "this(2)"
public class test {
public static void main(String[] args) {
new test();
}
test() {
this(2);
}
test(int x) {
System.out.println(x);
}
}
Chang Tzu-yu<br /> <br />SCJP 1.4
radhika ayirala
Greenhorn
Posts: 24
posted 16 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
thanks
chandraiah chintakayalu
Ranch Hand
Posts: 32
posted 16 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
when your calling a super constructor it should be called as:
super(2);
SCJP-5 86%,SCWCD-soon
Consider Paul's
rocket mass heater
.
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Bitwise inversion operator question
Calling a method
static block understanding
can't call another constructor from no-arg constructor
Is this java's Bug
More...