Parameter Declarations

Practice Questions

Computer Science › Parameter Declarations

Questions
3
1

Create the method stub for a void method called ingredients that takes in spaghetti, sauce, and meatballs as parameters where the parameters are all strings.

2

What keyword is needed to create a class variable?

3

CONSTRUCTORS

Consider the following Java code:

class Person

{

String firstName;

String lastName;

int age;

Person(String l, String f, int a)

{

firstName = f;

lastName = l;

age = a;

}

}

In main, how can I correctly create a person who is 21 years old, whose first name is Indiana, and whose last name is Jones?

Return to subject