1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Blababa [14]
4 years ago
7

Write a program that creates an ArrayList and adds a Loan object, a Date object, a string, and a Circle object to the list, and

use a loop to display all the elements in the list by invoking the object’s toString() method. Hint: Remember every class in Java is descended from the java.lang.Object class. Define Generic Type E appropriately for the ArrayList.
Computers and Technology
1 answer:
12345 [234]4 years ago
6 0

Answer:

//importing package java.util.ArrayList to use ArrayList in the program

import java.util.ArrayList;

import java.util.Date;

public class test_array_list {

// Main method

public static void main(String[] args) {

 // Create an array list of objects

 ArrayList<Object> s = new ArrayList<Object>();

 s.add(new Loan());  

 s.add(new Date());  

 s.add(new String("String class"));

 s.add(new Circle());

 // Display all the elements in the list by

 // invoking the object’s to String() method

 for (int element = 0; element < o.size(); element++) {

  System.out.println((s.get(element)).toString());

 }

}

}

Explanation:

The Above code has proper comments to which is self explanatory.

You might be interested in
Analyze the following code. II: public class Test { public static void main(String[] args) { System.out.println("Welcome to Java
Grace [21]

COMPLETE QUESTION

I. public class Test {

public static void main(String[] args){

System.out.println("Welcome to Java!");

}

}

II. public class Test { public static void main(String[] args) {System.out.println("Welcome to Java!");}}

Answer:

Both codes will compile and run and display Welcome to Java, but the code in II has a better style than I

Explanation:

When written codes, paying attention to proper coding styles and efficient memory management enables us to create programs that are highly efficient, coding styles refer to proper indentions and avoiding too lenghty lines of code (as is in code I), adding approprite comments etc.

8 0
3 years ago
What is the major problem with using pneumatics for robots, and how do we correct it?
Pepsi [2]
Well m<span>ost pneumatic system issues are caused by attempts to make a cylinder and related compressed air system components do something outside of the hardware’s design parameters. In order to fix this, use a filter regulator, do not oversize the cylinder, also ensure proper plant supply pressure, make sure you are using a manual, lockable air dump valve as well.
Hope this helps!</span>
4 0
3 years ago
6. Into how many areas are Blender®’s main screen separated? (1 point)
Ne4ueva [31]
I think it’s 5 hope I helped
6 0
3 years ago
Read 2 more answers
What do you mean by data sequencing​
Shalnov [3]

Answer:

Data sequencing is the sorting of data for inclusion in a report or for display on a computer screen.

Explanation:

8 0
3 years ago
What has prompted schools to add Internet activities in their academic integrity policies? a. New technological advancements c.
AysviL [449]

Answer:

A

Explanation:

Schools are trying to adjust to technology to help students.

6 0
3 years ago
Read 2 more answers
Other questions:
  • How will you be assigned with a mailbox with any OSP
    6·1 answer
  • Write a function namedadd_complex that adds the correspondingnumbers of its arguments (both complexstructures), then returns the
    5·1 answer
  • Wrire a code that display elements at indices 1 and 4 in the follwoing array.
    12·1 answer
  • Array elements are differentiated because each has a unique: O A) Range O B) Data Type o c) Index O D) Value
    5·1 answer
  • Write the definition of a method named add that receives a reference to a Scanner object associated with a stream of input consi
    13·1 answer
  • How can I make a video game?
    8·2 answers
  • The first thing you should select if you're using an Address Block or Greeting Line is
    11·1 answer
  • PLEASE IM IN AN EXAM I NEED HELP ASAPPP<br> (Appshed question)
    7·2 answers
  • Which types of online reading tools are available within the CloseReader? Check all that apply.
    11·1 answer
  • Scott sends his backups to a company that keeps them in a secure vault. What type of backup solution has he implemented?
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!