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...

  • 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...

  • 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...

  • I need to do the following to the program below: Problem formulation Following previous assignment (development...

    I need to do the following to the program below: Problem formulation Following previous assignment (development of the Asset class) you now need to extend it and create a few derivative classes, i.e. a Router, a Switch, a Server, a PSU (Power Supply Unit) etc. Each of those new classes has to be declared as extending the base Asset class and introduce new attributes and methods. For example, you may consider the following skeletons or add something that matches your...

  • 1-Suppose you write an application in which one class contains code that keeps track of the...

    1-Suppose you write an application in which one class contains code that keeps track of the state of a board game, a separate class sets up a GUI to display the board, and a CSS is used to control the stylistic details of the GUI (for example, the color of the board.) This is an example of a.Duck Typing b.Separation of Concerns c.Functional Programming d.Polymorphism e.Enumerated Values 2-JUnit assertions should be designed so that they a.Fail (ie, are false) if...

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
ADVERTISEMENT