logo

Java Programming | Assignment

Create two Java programs: one class that holds information about an object and provides relevant behavior, and a main program that tests the functions of the class.

9 Pages834 Words20 Views
   

Added on  2022-08-25

Java Programming | Assignment

Create two Java programs: one class that holds information about an object and provides relevant behavior, and a main program that tests the functions of the class.

   Added on 2022-08-25

ShareRelated Documents
Running head: JAVA PROGRAMMING ASSIGNMENT
Java Programming assignment
Name of the Student
Name of the University
Authors note
Java Programming | Assignment_1
JAVA PROGRAMMING ASSIGNMENT
1
In order to complete this assignment, the concept of inheritance and array lists are used.
For storing the array of objects, the array list is utilized. The ArrayList belongs to the collection
framework available in java which comes under the java.util package. Through this package we
can declare and use dynamic arrays in programs. Even though these collections are
comparatively slower than standard arrays. Here, it can be stated that the array lists are very
helpful in the applications where too many manipulations on the declared array is required.
ArrayList mainly inherits AbstractList class of java. Whenever used in the program it
implements List interface and executed in the program in order to store and manipulate the data
in the array. Even though the ArrayLists can be initialized with a specific size, but the size and
required memory can be increased or decreased whenever collection of data or objects are
increased or decreased depending upon the addition and removal of data from collection. The
ArrayList are also helpful in reducing required time for computations as it allows random access
to the list of objects. Here, it is important to mention that ArrayList objects are not to be used for
the storage and manipulation of the primitive data types such as int, double, char, string and so
on. In order to do so it is important to use a wrapper class. While developing the student details
program in Java, it is found that the ArrayList are capable of storing duplicate elements,
preserves insertion order of the objects/elements and non-synchronized. In case of the multi-
threaded environment, it is possible that too many threads will try to access or modify an
specific ArrayList simultaneously in that scenario final result becomes non-deterministic due to
the non-synchronized nature.
Student class
package pkg1225347;
Java Programming | Assignment_2
JAVA PROGRAMMING ASSIGNMENT
2
import java.util.Scanner;
/**
*
* @author user
*/
public class studentclass {
String Name;
int id;
String loc;
double marks;
String subject;
public studentclass(String Name, int id, String loc, double marks, String subject)
{
this.Name=Name;
this.id=id;
Java Programming | Assignment_3

End of preview

Want to access all the pages? Upload your documents or become a member.

Related Documents
Java Assignment Codes
|52
|5341
|240

Object Oriented Programming using Java
|14
|585
|389

Java Programming Assignments with Solutions
|9
|904
|164

Object Oriented Programming with Java
|9
|1142
|153

Temperature Recording Program: Java Implementation for Daily and Weekly Temperature Tracking
|7
|1100
|494

PriorityThreadQueue and ListManager
|4
|670
|24