1. Variables created within a method can be accessed outside that method. OFalse
ID: 3867295 • Letter: 1
Question
1. Variables created within a method can be accessed outside that method. OFalse 2. The structure of a class consists of properties and behaviors. False 3. Which two statements are true about the main method? (Choose all correct answers) The main method should be as simple as possible. The main method is commonly used to instantiate objects. The main method should store the properties and behaviors of objects. The main method should be able to freely manipulate an object's fields. 4. Java automatically dears the memory once occupied by an object using garbage collection. False 5. What is the output of the following code? String s1 = "Hello"; String s2"Welcome!" s1 = s2; System.out.printin"'s1:+s1); Osi: Welcome! Osi: Welcome! s2: Hello O s1: Hello s2: Welcome! Os1: Hello s2: HelloExplanation / Answer
Question 1
Answer: False
Question 2
Answer: True
Question 3
Answer:
THe main method should be as simple as possible
The main method is commonly used to instantiates objects
Question 4
Answer: False
Question 5
Answer:
s1: Welcome
s2: Welcome
Question 6
Answer: True
Question 7
Answer: new
Question 8
Answer:
All objects of the same class have the same methods.
Each new instances of an object will have a different location memory
Question 9
Answer: Local variables
Question 10
Answer:
public Employee(String name, double salary) {
this.name = name;
this.salary = salary;
}
Question 11
Answer: True
Question 12
Answer: null
Question 13
Answer: True
Question 14
Answer: True
Question 15
Answer:
A contructor method may return a value
A constructor has a void return type
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.