Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Beginning Java
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
Ron McLeod
Paul Clapham
Tim Cooke
Devaka Cooray
Sheriffs:
Liutauras Vilda
paul wheaton
Rob Spoor
Saloon Keepers:
Tim Moores
Stephan van Hulst
Tim Holloway
Piet Souris
Mikalai Zaikin
Bartenders:
Carey Brown
Roland Mueller
Forum:
Beginning Java
What is the output for this Class
jami siva
Ranch Hand
Posts: 66
posted 14 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
what is the output for the above code , In K & B,page 281, they given output as :
A. The output could contain 30
B. The output could contain @bf73fa
public class Bridge { public enum Suits { CLUBS(20), DIAMONDS(20), HEARTS(30), SPADES(30), NOTRUMP(40) { public int getValue(int bid) { return ((bid-1)*30)+40; } }; Suits(int points) { this.points = points; } private int points; public int getValue(int bid) { return points * bid; } } public static void main(String[] args) { System.out.println(Suits.NOTRUMP.getBidValue(3)); System.out.println(Suits.SPADES + " " + Suits.SPADES.points); System.out.println(Suits.values()); } }
But when i run this application ,i got compilation error , because getBidValue() is not there in enum class.
Any one help for this
Campbell Ritchie
Marshal
Posts: 79698
381
posted 14 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Most likely a spelling error. Try getValue rather than getBidValue.
We cannot change unless we survive, but we will not survive unless we change. Evolving tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
K & B, Chapter 3, Quiz Question 7
Can You Find the Error in this SCJP6 Study Guide Mock Exam Question?
question 7 of chapter 3
Info concerning the updates to the SCJP 6 exam
enums
The WEB SERVICES and JAX-RS Course
More...