using objects

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

What is returned by this method call: translator("pokemon")? public String translator(String word) { return word.substring(1) + word.charAt(0) + "ay"; }

"okemonpay"

What will the value of myBankAccount be after the method call depositMoney(myBankAccount, 572);? int myBankAccount = 122; public void depositMoney(int bankAccount, int deposit) { bankAccount += deposit; }

122

What does this method call doubleNumber(7.8); return, given the following method? public double doubleNumber(double myNumber) { return (double) (int) myNumber * 2; }

14.0

What will the method call formatText(2018, 17, "Dec") print to the screen? public static void formatText(int a, int b, String c) { System.out.println(b + " " + c + ", " + a); }

17 Dec, 2018

Why do we use methods in Java? I. To make code easier to understand II. To define global variables III. To avoid repeated code IV. To simplify code V. To avoid needing to define them as public or private

I, III, and IV

What is true of a void method?

It returns no value.

How do you square the minimum value between two values, such as x and y?

Math.pow(Math.min(x, y), 2);

What is wrong with this method definition? public int printPayAmount(int amount) { System.out.println(amount); }

Nothing is returned from this method

What are parameters?

The formal names given to the data that gets passed into a method.

What does the method call tripleString("APCSA"); return for the following method? public String tripleString(String x) { return x * 3; }

This method is improperly written.

The value that a non-void method outputs is called

a return value

what does str="i am"; str+=10+3; return?

iam13

A procedure that is defined by the user is called a

method

If an instance variable is called, but has not been set to a value yet, what returns?

null

Which of the following produces a random number between 1-100?

return (int)(Math.random()*100+1)

Can wrapper classes be used in primitive methods?

yes


संबंधित स्टडी सेट्स

CRCM Study Flash Cards Tier 1 Regulations - Non Reg Z

View Set

AP World Unit 6 Practice Quizzes

View Set

California Real Estate Salespersons Course Gollasary

View Set

Advantages and disadvantages of air masses

View Set

money, inflation & quantity theory

View Set

ServSafe Unit II: The Flow of Food Through the Operation

View Set

Chapter 13 - The Molecular Basis of Inheritance

View Set