canvas.un1.edu Yahoo Search Web Search Home - zyBooks 8.5. File input and output
ID: 3604152 • Letter: C
Question
canvas.un1.edu Yahoo Search Web Search Home - zyBooks 8.5. File input and output 8.7. Ch 8 Program: Playlist (... 8.4. Streams using Strings L9Pre: COMPUTER SCIENCE. Providing Constructors for Yo.+ 1MG-0264.JPG 0/0.5 pts Question 9 4-5 11 (0 F2288179-E979-46F2-AA09 20E74856-C898-4889-85A. Account When you run a Java application by typing the line on your terminal/command prompt: java SomeClass; ...what is the first method that starts? Dashboard 28 The run) method of SomeClass Correct Answer The main method of SomeClass Calendar the SomeClass( method. Inbox any of the other answers could start first Help Question 10 0/0.5 pts A class may have more than one defined constructor Correct Answer TrueExplanation / Answer
Quesiton 9:
Answer:
If you are runing code in terminal you need to have main() method without any main method you can't run the code:
Example:
public class Test {
public static void main(String[] args) {
int i = 0;
// loops untill 5 times
while (i < 5) {
// print i
System.out.println(i);
i++;
}
}
}
Question 10:
Answer:
Yes you can have 1 or more constructor in java
Example :
public class Person {
String fName;
String lName;
Date dob;
// Constructor 1
public Person(String fName, String lName, Date dob) {
this.fName = fName;
this.lName = lName;
this.dob = dob;
}
// Constructor 2
public Person(){
this.fName = "test1";
this.lName = "test2";
}
}
Here Person class have 2 constructor
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.