
/**********************************************ListDemo.java********************************/
import java.util.ArrayList;
/**
* Demo using an ArrayList
*
* @author JUGAL KISHOR SAINI
* @version April,29,2019
*/
public class ListDemo {
private ArrayList<String> list;
public ListDemo() {
list = new
ArrayList<String>();
}
public void useList() {
String blueColor = "blue";
//creating a string object
list.add(blueColor); //add string
to array list
list.add("yellow"); //add String to
array list
/*
* print the size of list
* print the first element
*/
System.out.println("The list has
"+list.size()+" elements");
System.out.println("The first
element is "+ list.get(0));
/*
* remove the first element of
list
* print removed color from
list
* print number of element in the
list
*/
String removedColor =
list.remove(0);
System.out.println("Removed element
"+removedColor);
System.out.println("Now the list
has "+list.size()+" elements");
}
public static void main(String[] args) {
/*
* create object of ListDemo
*/
ListDemo listDemo = new
ListDemo();
/*
* use method of ListDemo
*/
listDemo.useList();
}
}
![38 390public static void main(String1 40 41 42 43 main(Stringt] args) f args) create object of ListDemo ListDemo listDemo-new](http://img.homeworklib.com/images/1c036d7f-5640-46b8-9a08-3f1957041eec.png?x-oss-process=image/resize,w_560)
/**********************************output*************************/
The list has 2 elements
The first element is blue
Removed element blue
Now the list has 1 elements
![ConsoleX <terminated> ListDemo [Java Application] C:\Program F The list has 2 elements The first element is blue Removed elem](http://img.homeworklib.com/images/fccef8b4-89a5-4a64-865b-8fff7366961b.png?x-oss-process=image/resize,w_560)

Thanks a lot, Please let me know if you have any problem.........
Open BlueJ and create a new project (Project->New Project...). Create a new class named ListsDemo. Open the source code and delete all the boilerplate code. Type in the code to type (code to type...
Create a new project in BlueJ and name it LastName-lab8-appstore, e.g., Smith-lab8-appstore. If your App class from Lab 4 is fully functional, copy it into the project. (You can drag a file from File Explorer onto the BlueJ project window.) Otherwise, use the instructor's App class: Create a new class using the "New Class..." button and name it App. Open the App class to edit the source code. Select and delete all the source code so that the file is...
C++ Lab 9A Inheritance Employee Class Create a project C2010Lab9a; add a source file Lab9a.cpp to the project. Copy and paste the code is listed below: Design a class named Employee. The class should keep the following information in member variables: Employee name Employee number Hire date // Specification file for the Employee class #ifndef EMPLOYEE_H #define EMPLOYEE_H #include <string> using namespace std; class Employee { private: // Declare the Employee name string variable here. // Declare the Employee...
In a project named 'DogApplication', create a class called 'Dog' 1. declare two instance variables in 'Dog' : name (String type) age (int type) 2. declare the constructor for the 'Dog' class that takes two input parameters and uses these input parameters to initialize the instance variables 3. create another class called 'Driver' and inside the main method, declare two variables of type 'Dog' and call them 'myDog' and 'yourDog', then assign two variables to two instance of 'Dog' with...
A teacher wants to create a list of students in her class. Using the existing Student class in this exercise. Create a static ArrayList called classList that adds a student to the classList whenever a new Student is created. In the constructor, you will have to add that Student to the ArrayList. Coding below was given to edit and use public class ClassListTester { public static void main(String[] args) { //You don't need to change anything here, but feel free...
A teacher wants to create a list of students in her class. Using the existing Student class in this exercise. Create a static ArrayList called classList that adds a student to the classList whenever a new Student is created. In the constructor, you will have to add that Student to the ArrayList. Coding below was given to edit and use public class ClassListTester { public static void main(String[] args) { //You don't need to change anything here, but feel free...
PART 1: GETTING STARTED 1. Create a new Java Project. 2. Create a new Tree class and enter this code. You do not have to type in the comments public class Tree { private String name; private int age; private bogJsAn evergreen; // true if evergreen // false if deciduous //CONSTRUCTORS public Tree( { name 0; evergreen = true; age } // you fill this one public Tree (String n, jnt a, bgalean e) //PUT YOUR CODE HERE } //...
// Client application class and service class Create a NetBeans project named StudentClient following the instructions provided in the Starting a NetBeans Project instructions in the Programming Exercises/Projects Menu on Blackboard. Add a class named Student to the StudentClient project following the instructions provided in the Starting a NetBeans Project instructions in the Programming Exercises/Projects Menu on Blackboard. After you have created your NetBeans Project your application class StudentC lient should contain the following executable code: package studentclient; public class...
I was told I need three seperate files for these classes is there anyway to tie all these programs together into one program after doing that. I'm using netbeans btw. import java.util.ArrayList; import java.util.Scanner; /** * * */ public class MySorts { public static void main(String[] args) { Scanner input = new Scanner(System.in); String sentence; String again; do { System.out .println("Enter a sentence, I will tell you if it is a palindrome: ");...
Set-Up · Create a new project in your Eclipse workspace named: Lab13 · In the src folder, create a package named: edu.ilstu · Import the following files from T:\it168\Labs\lab13. Note that the .txt file must be in the top level of your project, not inside your src folder. o Student.java o StudentList.java o students.txt Carefully examine the Student.java and StudentList.java files. You are going to complete the StudentList class (updating all necessary Javadoc comments), following the instruction in the code....
Java help: 1.1) Create a class TA that extends class Student. 1.2) Add a variable to the TA class to represent the course the student is TA'ing. 1.3) Provide a constructor for the class so the code in the PeopleFactory will work as provided. 1.4) Provide a toString() method for the TA class so that TA's will output as shown in the sample code. Provide a class Staff so that you can un-comment the lines of code in the PeopleFactory class that...