Question

I'm doing a practice test and I can't seem to find the answers anywhere for these...

I'm doing a practice test and I can't seem to find the answers anywhere for these specific questions. If someone could please help clarify so I can learn that would be helpful!

5.

3. public class Person {
4. private double salary;
5. public Person() {
6. salary = 1000.0;
7. }

What type of constructor is illustrated by lines 5 through 7?


6. Identify the true statements. Select ALL that apply.

a. Constants in a class should be declared as final static.

b. Static variables and static methods of a class can be accessed by an object of that class and by the class name.

c. Static variables have a default value of null.

d. Anonymous objects are possible in Java.


7. What Java keyword sometimes used in a class definition refers to the class itself?

0 0
Add a comment Improve this question Transcribed image text
Answer #1

7 No-argument constructor

since this constructor does not have any parameter

6 true statement

a. Constants in a class should be declared as final static.

b. Static variables and static methods of a class can be accessed by an object of that class and by the class name.

d . Anonymous objects are possible in Java.

7 this

Add a comment
Know the answer?
Add Answer to:
I'm doing a practice test and I can't seem to find the answers anywhere for these...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • I'm still fairly new to java and I haven't programmed with it in half a year,...

    I'm still fairly new to java and I haven't programmed with it in half a year, so I can't for the life of me figure this out even though I know its really simple. I'll paste the 2 classes below so any help is much appreciated. The TODO comments are what I'm supposed to do. public class Main { public static void main(String[] args) { /* * This is for the first part of the lab. */    Planner coursePlan...

  • Question 1 1 pts Which of the following is not a valid class name in Java?...

    Question 1 1 pts Which of the following is not a valid class name in Java? O MyClass MyClass1 My_Class MyClass# Question 2 1 pts Which of the following statements is False about instance variables and methods? Instance variables are usually defined with private access modifier. Instance variables are defined inside instance methods. Instance methods are invoked on an object of the class that contains the methods. A class can have more than one instance variables and methods. Question 3...

  • in JAVA Which of the following attributes would be MOST appropriate for a class called Book,...

    in JAVA Which of the following attributes would be MOST appropriate for a class called Book, that represents a book in a library? libraryName, location, libraryHours title, author, typeOfBook pages, cost, shipping anything, anytime, anywhere Which of the following statements is FALSE regarding constructors? A constructor allows you to set up an object once it is instantiated. A constructor does not have a return type. A constructor must have the same name as the name of the class. You can...

  • I need help for part B and C 1) Create a new project in NetBeans called...

    I need help for part B and C 1) Create a new project in NetBeans called Lab6Inheritance. Add a new Java class to the project called Person. 2) The UML class diagram for Person is as follows: Person - name: String - id: int + Person( String name, int id) + getName(): String + getido: int + display(): void 3) Add fields to Person class. 4) Add the constructor and the getters to person class. 5) Add the display() method,...

  • Exponential and Log I'm trying to prepare for a test tonight and I can't figure out how to set up...

    Exponential and Log I'm trying to prepare for a test tonight and I can't figure out how to set up the formula Class discussion: 1. Write an exponential equation tha always define the variables that you use at matches cach of the following descriptions. Remember to a. The world's population was 7 billion in 2011 and was doubling about every 54 years.. b. On your 50th birthday twelve thousand dollars was put into a retirement account that pays 3% interest...

  • Tried numerous times but I think I'm doing this problem wrong. Will give thumb's up for...

    Tried numerous times but I think I'm doing this problem wrong. Will give thumb's up for help. JAVA starter code: import java.util.Scanner; public class ArraySorter { public static void main(String[] args) { Scanner sc = new Scanner(System.in);    // Read in k, which represents the maximum // distance between a number's current position // and sorted position int k = Integer.parseInt(sc.nextLine());    // Read in the list of numbers int[] numbers; String input = sc.nextLine(); if (input.equals("")) { numbers =...

  • 1. What is output by the following code: ArrayList< Integer > a = new ArrayList< Integer...

    1. What is output by the following code: ArrayList< Integer > a = new ArrayList< Integer >(); ArrayList b = a; a.add(new Integer(4)); b.add(new Integer(5)); a.add(new Integer(6)); a.add(new Integer(7)); System.out.println(b.size()); A)1 B)2 C)3 D)4 E)5 2. Assume the Student and Employee classes each extend the Person class. The Student class overrides the getMoney method in the Person class. Consider the following code:     Person p1, p2, p3;     int m1, m2, m3;     p1 = new Person();     m1 = p1.getMoney();     // assignment 1...

  • Download BankAccount.java and BankAccountTester.java starting files and drag and drop them into your eclipse project. The...

    Download BankAccount.java and BankAccountTester.java starting files and drag and drop them into your eclipse project. The BankAccount class declaration in file BankAccount.java is the blueprint of a BankAccount object. Check out the design of a BankAccount class. 1. In BankAccount.java class, all of the method stubs ( methods with a header but empty bodies ) are present to help you get started. Your task is to complete the method bodies. All comments in red in the diagram above indicates what...

  • Tasks A. (20 po ints) In Lab 6, you defined and implemented a class called Date....

    Tasks A. (20 po ints) In Lab 6, you defined and implemented a class called Date. You will make some modific ation to the Date class so that it mccts the folowing specific ations: The Date class consists of three private member variables: Member Variable year month day Description An int variable that hokls the value of a year. An int variable that hokds the value of a month An int variable that hokis the value of a day. The...

  • Need help with java programming. Here is what I need to do: Write a Java program...

    Need help with java programming. Here is what I need to do: Write a Java program that could help test programs that use text files. Your program will copy an input file to standard output, but whenever it sees a “$integer”, will replace that variable by a corresponding value in a 2ndfile, which will be called the “variable value file”. The requirements for the assignment: 1.     The input and variable value file are both text files that will be specified in...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT