Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

simple Java****.I have 3 classes (ad, shp,sim). ad has 3 string and getter and setter. shp has ad list object. and sim has main method

simple Java****.I have 3 classes (ad, shp,sim). ad has 3 string and getter and setter. shp has ad list object. and sim has main method and setting value. but for some reason I didn't get any value when I run it. please help me.

package simulation;

public class ad { private String model; private String size; private String colore; public String getModel() { return model; } public void setModel(String model) { this.model = model; } public String getSize() { return size; } public void setSize(String size) { this.size = size; } public String getColore() { return colore; } public void setColore(String colore) { this.colore = colore; } } -----------------------------------------------------

package simulation;

import java.util.List;

public class shp { private Listadd=null;

public List getAdd() { return add; }

public void setAdd(List add) { this.add = add; }}

--------------------------

package simulation;

import java.util.ArrayList; import java.util.List;

public class sim { public static void main(String[] args) { ad obj= new ad(); List add = new ArrayList(); shp shpp= new shp(); obj.setColore("blue"); obj.setModel("suv"); obj.setSize("big"); add.add(obj); shpp.setAdd(add); System.out.println(shpp.getAdd()); } }

______________

the output [simulation.ad@15db9742]

-----------------------

I suppose to get blue,suv,big

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Fundamentals Of Database Management Systems

Authors: Mark L. Gillenson

3rd Edition

978-1119907466

More Books

Students also viewed these Databases questions