Mastering Java: The Ultimate Quiz for 'Thinking in Java'

Disable ads (and more) with a membership for a one time $2.99 payment

Dive into the depths of Java with our quiz based on "Thinking in Java, Fourth Edition" by Bruce Eckel. Test your knowledge, solidify concepts, and prepare for certification with challenging questions and insightful feedback.

Each practice test/flash card set has 50 randomly selected questions from a bank of over 500. You'll get a new set of questions each time!

Practice this question and more.


What is the return type of the setCycles method in the SineDraw class?

  1. int

  2. void

  3. double[]

  4. String

The correct answer is: void

The setCycles method in the SineDraw class does not return a value, but rather sets the value of the cycles variable to a given input. This means that the return type of the setCycles method is void, as it does not return any value. Option A, int, cannot be correct because the setCycles method does not return an integer value. Option C, double[], cannot be correct because the setCycles method does not return an array of double values. Option D, String, cannot be correct because the setCycles method does not return a String value.