exam questions

Exam 1z0-811 All Questions

View all questions & answers for the 1z0-811 exam

Exam 1z0-811 topic 1 question 48 discussion

Actual exam question from Oracle's 1z0-811
Question #: 48
Topic #: 1
[All 1z0-811 Questions]

Which method identifier is correct according to Java naming conventions?

  • A. BillCalculator
  • B. calculateBill
  • C. calculatebill
  • D. Calculator
Show Suggested Answer Hide Answer
Suggested Answer: D 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
brunojee
2 months, 3 weeks ago
Selected Answer: B
According to Java naming conventions, the correct method identifier from the options provided is: B. calculateBill Here's a breakdown of the naming conventions in Java: Classes should be named using PascalCase (also known as UpperCamelCase), where each word starts with a capital letter (e.g., BillCalculator or Calculator). So A and D are valid class names, not method names. Methods should be named using camelCase (also known as lowerCamelCase), where the first word is lowercase and subsequent words start with an uppercase letter (e.g., calculateBill). Thus, B is correct. C. calculatebill uses all lowercase letters for the second part of the identifier, which does not follow the camelCase convention, making it incorrect. So, B is the only correct answer for a method identifier according to Java naming conventions.
upvoted 1 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago