JAVA
QUESTION 1
The value returned by a value-returning method can be saved for further calculation in the program.
True
False
QUESTION 2
To use a predefined method you must know the code in the body of the method.
True
False
QUESTION 3
A formal parameter is a variable declared in the method heading (ie. it's signature).
True
False
QUESTION 4
A local identifier is an identifier that is declared within a method or block and that is visible only within that method or block.
True
False
QUESTION 5
No two methods in the same class can have the same name.
True
False
QUESTION 6
Void methods have no return type.
True
False
QUESTION 7
The return statement must be the last line of the method.
True
False
QUESTION 8
When a program executes, the first statement to execute is always the first statement in the main method.
True
False
QUESTION 9
Given the method heading
public static String exampleMethod(int n, char ch)
what is the return type of the value returned?
int |
||
char |
||
String |
||
Nothing will be returned |
QUESTION 10
The method toString() is used to convert an object to a String object.
True
False
1) True 2) False 3) True 4) True 5) False 6) True 7) False 8) False 9) String 10) True
JAVA QUESTION 1 The value returned by a value-returning method can be saved for further calculation...
I need java code for the following problem. Lab 7: Methods 1. Write a Java program called Numbers that calls the following methods and displays the returned value: Write a method called cubelt that accepts one integer parameter and returns the value raised to the third power as an integer. o Write a method called randominRange that accepts two integer parameters representing a range. The method returns a random integer in the specified range inclusive. 2. o Write a method...
true or false in JAVA 1) A literal value is a value that is typed directly into the code, such as 10, 14.6, or "Bob". 2) Local variables can only be accessed from within the block in which they are defined. 3) All variables must be declared before they can be used. 4) If a method returns nothing, its return type should be null. 5) A method with an int parameter can be invoked with a String argument. 6) A...
. Design a class named MyInteger. The class contains: An int data field named value that stores the int value represented by this object. A constructor that creates a MyInteger object for the specified int value. A getter method that returns the int value. The methods isEven(), is Odd(), and isPrime() that return true if the value in this object is even, odd, or prime, respectively. The static methods isEven(int), isOdd(int), and isPrime(int) that return true if the specified value...
ANY ANSWER IS MUCH APPRECIATED. THANK YOU!! QUESTION 1 ________ are useful for returning more than one value from a method. Default arguments Parameter lists Reference parameters Named arguments 1 points QUESTION 2 When you call a ________ method, it executes its code and returns without passing any value back to the program statement that called it. void private terminal value-returning 1 points QUESTION 3 You can pass string literals as arguments to methods containing string parameters. True False...
IN JAVA 38. What is the return type of the String class compareTo( ) method? A) boolean B) int C) String D)coid 39. What is the return type of the constructor method of a class? A) void B) Object C) no return type is allowed D) int 40. A class can have many different constructor methods as long as the names are different. A)true B) false
QUESTION 1 Each class must be declared in its own .java file True or False? QUESTION 2 The keyword this must always be explicitly used when referring to an object's instance variables and methods from within one of its non-static methods. True or False? QUESTION 3 When used in a class' main method the this keyword references the object representing the class itself. True or False? QUESTION 4 Accessor methods that test whether a condition is true or false are...
Consider the following methods’ headers: public static int one(int a, char b, double c, String d) public static double two(double x, double y) public static char three(int r, int s, char t, double u) Answer the following questions: Q1) What is the signature of method one? Answer: Q2) What is the return type of method two? Answer: Q3) What the formal parameters of method three? Answer: Q4) How many actual parameters are needed to call the method three? Answer: Q5)...
Java Description This project is designed to help you practice for the second midterm examination. First you will hand write the code for the project, just as you would do on the examination. Then you will take your hand written code and enter it into eclipse and debug/fix it. This should help you identify challenges that you have in hand writing code that could cause problems on the midterm on Wednesday Write a program that generates platitudes, by writing each...
Within DrJava, create a class called StudentQuizScores and do the following using a do-while loop. 1. You program will read in a student’s first name. The same will be done for the student’s last name. Your program will use respective methods (described below) to accomplish this. 2. Your program will then read in three quiz scores, respectively. This should be done by using the same method three times. This method is described below. 3. Your program will then calculate the...
JAVA programing Question 1 (Date Class): 5 Points Create a class Date with the day, month and year fields (attributes). Provide constructors that: A constructor that takes three input arguments to initialize the day, month and year fields. Note 1: Make sure that the initialization values for the day, month and year fields are valid where the day must be between 1 and 31 inclusive, the month between 1 and 12 inclusive and the year a positive number. Note 2:...