Real Time code for Array list

Real Time code for Array list

View Answers

July 22, 2009 at 4:21 PM

Hi Friend,

Try the following code:

import java.util.*;

class Student {
public Student(String n, double s, int year, int month, int day){
name = n;
marks = s;
GregorianCalendar calendar = new GregorianCalendar(year, month - 1, day);
admissionDate = calendar.getTime();
}
public String getName(){
return name;
}
public double getMarks(){
return marks;
}
public Date getAdmissionDate(){
return admissionDate;
}
public void raiseMarks(double p){
double raise = marks * p / 100;
marks += raise;
}
private String name;
private double marks;
private Date admissionDate;
}
public class ArrayListExample{
public static void main(String[] args){
ArrayList<Student> student = new ArrayList<Student>();
student.add(new Student("A", 90, 2001, 10, 15));
student.add(new Student("B", 95, 2002, 7, 1));
student.add(new Student("C", 85, 2003, 4, 15));
student.add(new Student("D", 80, 2004, 8, 1));
for (Student s : student)
s.raiseMarks(5);
for (Student s : student)
System.out.println("Name=" + s.getName() + " Marks=" + s.getMarks() + " Admission Date="+ s.getAdmissionDate());
}
}

Hope that it will be helpful for you.
Thanks









Related Tutorials/Questions & Answers:
Real Time code for Array list - Development process
Real Time code for Array list  Hi, Can u give me sample code for Arraylist in real time applications. Thanks PraKash  Hi Friend, Try the following code: import java.util.*; class Student { public
Array list java code - Java Beginners
Array list java code  Create an employee class with an employee id's,name & address. Store some objects of this class in an arraylist. When an employee id is given, display his name & address? Please provide the DETAIL java code
Advertisements
Array list java code - Java Interview Questions
Array list java code  Create an employee class with an employee id's... an employee id is given, display his name & address? Please provide the DETAIL java code... in your code?Please clarify it. Thanks  i need the java code
real time question
real time question  can you just give me the example of using hibernate in DAO classes   Hi Friend, Please visit the following link: Hibernate Tutorials Thanks
Real time examples - Java Beginners
Real time examples  what is method overloading,method overriding,constructor overloading concept in java and explain with real time examples? .../javascript-array/modified-java-method-overriding.shtml http://www.roseindia.net/java
Real Time Scenarios - Development process
Real Time Scenarios  Hello, Can anybody tell me regarding the Quality Processes that are to be followed while developing an application using struts/ejb ?  Hi The Quality Process is totally depend on the quality
what is the use of clone() in real time scenario?
what is the use of clone() in real time scenario?  what is the use of clone() in real time scenario?   Hi Friend, Clone() method is used to create and return copy of the object. For more information, visit
Displaying database table on the windows screen in real time.
Displaying database table on the windows screen in real time.  Problem statement... I have a database table which is running on a remote host .I... can give the code for this. Thank u
array list
array list  How to get repeate occurence values from database table in java by using arraylist
Real Time Mobile Tracking
Real Time Mobile Tracking Real time mobile tracking is all about being able... technology. Real time mobile tracking is a web-based solution that helps in attaining... in real time using the GSM/GPRS technology by gathering data in the process about
Array List
Array List   Complete the class House and HouseApp below to display class House{ int lotNo; String type; //Bungalow, SemiDetached double price; public House ( int l, String t, double p) { ââ?¬Â¦ } public int theLotN() { Ã
Array List
Array List  Could somebody help me to solve this question. I am glad to hear ideas or answers from everyone. The situation: Complete the class House and HouseApp below to display class House{ int lotNo; String type
Real Time GPS Fleet Tracking
efficiency, logistics companies need the real time fleet management solution. The real time fleet tracking solution helps the companies to exactly pin pointing... real time GPS fleet tracking system. The biggest profits of real time GPS
Real Time Example Interface and Abstract Class - Java Beginners
Real Time Example Interface and Abstract Class  Hi Friends, can u give me Real Time example for interface and abstract class.(With Banking Example
ModuleNotFoundError: No module named 'real-time-analog-monitoring-tool'
ModuleNotFoundError: No module named 'real-time-analog-monitoring-tool' ...: ModuleNotFoundError: No module named 'real-time-analog-monitoring-tool' How to remove the ModuleNotFoundError: No module named 'real-time-analog-monitoring-tool'
ModuleNotFoundError: No module named 'devops-microsoft-client-real-time'
ModuleNotFoundError: No module named 'devops-microsoft-client-real-time' ...: ModuleNotFoundError: No module named 'devops-microsoft-client-real-time' How to remove the ModuleNotFoundError: No module named 'devops-microsoft-client-real-time'
ModuleNotFoundError: No module named 'devops-microsoft-sspo-real-time'
ModuleNotFoundError: No module named 'devops-microsoft-sspo-real-time' ...: ModuleNotFoundError: No module named 'devops-microsoft-sspo-real-time' How to remove the ModuleNotFoundError: No module named 'devops-microsoft-sspo-real-time' error
array list example
array list example  Array list example   Hello Friend, Please visit the following links:ADS_TO_REPLACE_1 Array List Example1 Array List Example2 ThanksADS_TO_REPLACE_2
Real-time GPS fleet Management
Fleet business depends on real-time GPS fleet management. Now to make it clear... and Passive. The former one shows and store data regularly and in real time so... used. GPS fall under the Active technology and give the real time update
Java ArrayList, Java Array List examples
of the List interface. It has support for all the functions present in the List interface... the ArrayList in Java with the example code. SampleInterfaceImp.java import... ArrayList list = new ArrayList(); // Adding Element to the ArrayList Object
Real time Mechanism fot Sessio Tracking - Servlet Interview Questions
Real time Mechanism fot Sessio Tracking   Hi Friends, Which is d most commonly used mechanism for tracking a session. and y it is best . thanks in advance
getting html list in a array
getting html list in a array  hi i want to get html unordered list in a array using jsp
getting html list in a array
getting html list in a array  hi i want to get html unordered list in a array using jsp
Array List and string operation
Array List and string operation  hi, I want to search an arraylist element in a a given file. example I have a name called "mac" in my arraylist... file. please give me the code
Time series sorce code
Time series sorce code   hi.......... I want to show the output of my project as time series. Can u give me a simple code for time series. Where i amble able to put on x-axis the date and y-axis the range.? I require the time
Time series sorce code
Time series sorce code   hi.......... I want to show the output of my project as time series. Can u give me a simple code for time series. Where i amble able to put on x-axis the date and y-axis the range.? I require the time
array of students with marks list
array of students with marks list  There are 4 array of numbers or scores as below. They are called marks list and represent the scores individual... across all lists and also the number of students (4 in this case). Marks List 1
Create list from array in Java
Create list from array in Java  Hi, I have an array with some data. How to Create list from array in Java? Thanks   Hi, Here is example... this into array: List<String> list = Arrays.asList(names); Thanks
Online Real-Time GPS Phone Tracking Service
Online Real-Time GPS Phone Tracking Service Online Real-Time GPS Phone... to track, trace and monitor mobile phones in real time. There are number of types... for GPS for tracking phone devices thus has real-time benefits. A basic unit
Convert Array to List
Convert Array to List       In this section, you will learn to convert an Array to ListCode... to List. Here we have taken an array of data which gets converted to List using
What is RTLS or Real Time Location System?
RTLS or Real Time Location System is a positioning system that acquired new... for incorporating many other features. RTLS or Real Time Positioning System compared... tracking system is an active real time based solution that can use radio frequency
Convert List to Array
Convert List to Array       Lets see how to convert List to ArrayCode Description... a method Mylist.toArray to convert the List to Array. Here is the code
How to Convert array to list in Java
How to Convert array to list in Java  Hi, I have object of array in Java and I want to convert it to list. How to Convert array to list in Java... ArrayToList { public static void main(String[] args) { List arrList = new
PHP list array keys
array_keys() function returns the keys of the the given array. It returns the keys in the form of array. Example of PHP list Array Keys <?php     $ar1=array("x"=>"x-mas","y"=>"yak","zebra");  
Create a web application using any technology to display 10 most relevant tweets from Twitter in real-time for the keyword
tweets from Twitter in real-time for the keyword   Create a web application using any technology to display 10 most relevant tweets from Twitter in real-time for the keyword "@cldmgc
Create a web application using java technology to display 10 most relevant tweets from Twitter in real-time for the keyword
tweets from Twitter in real-time for the keyword   Create a web application using java technology to display 10 most relevant tweets from Twitter in real-time for the keyword
create a web application using java dat accepts 10 relevant tweets frm twitter in real time for dat keyword
create a web application using java dat accepts 10 relevant tweets frm twitter in real time for dat keyword   create a web application using java dat accepts 10 relevant tweets frm twitter in real time for dat keyword
web application using any technology to display 10 most relevant tweets from Twitter in real-time
web application using any technology to display 10 most relevant tweets from Twitter in real-time  web application using any technology to display 10 most relevant tweets from Twitter in real-time
Shuffling the Element of a List or Array
Shuffling the Element of a List or Array   ... the list or array to prepare each and every element for the operation. In this section, you will learn about shuffling the element of a list or array. Shuffling
PHP list array
Array Code for PHP List Array <?php     $stud = array(1... Syntax for PHP List Array void list(var arg1,var arg2,var arg3) list() is used to assign many variables at a time. It takes variable values from
create a web application using java dat accepts 10 relevant tweets frm twitter in real time for dat keyword
create a web application using java dat accepts 10 relevant tweets frm twitter in real time for dat keyword   create a web application using java dat accepts 10 relevant tweets frm twitter in real time for dat keyword  
Creation Time Comparison of Multi Dimensional Array- Java Tutorials
Creation Time Comparison of Multi Dimensional Array In this section, we will compare the creation time between the different size/dimension of array. ... Elapsed for [] - " + time); } } Output : The output of the above code shows
Array list in Java - arraylist type error
Array list in Java - arraylist type error  I am using Array list in Java but when i compile i get array list type error. Can anyone please explain what is array list type error and why it occurs
Read file into byte array java code eample
Read file into byte array java code eample  Hi, I have a project where I have to write for that reads file into byte array. I want a code java code... array in Java. Hope the above example code will help you in finding the solution
ModuleNotFoundError: No module named 'code_time_tracker'
ModuleNotFoundError: No module named 'code_time_tracker'  Hi, My... named 'code_time_tracker' How to remove the ModuleNotFoundError: No module named 'code_time_tracker' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'code_time_tracker'
ModuleNotFoundError: No module named 'code_time_tracker'  Hi, My... named 'code_time_tracker' How to remove the ModuleNotFoundError: No module named 'code_time_tracker' error? Thanks   Hi, In your
jsp code for storing login and logout time to an account
jsp code for storing login and logout time to an account  I need simple jsp code for extracting and storing login and logout time in a database table..plz someone help me...   Please visit the following link: http
Date Time Problem In Jsp code - Development process
Date Time Problem In Jsp code  Hi Friends, By using this code , am storing date and time into msaccess database. But while retriving i want to get same date and time .send me code for that. SimpleDateFormat
Array list java program - Java Interview Questions
Array list java program  Create an employee class with an employee... code for this query i.e.,how we can create a class for employee with id's,name..., Try the following code: import java.io.*; import java.util.*; class
java code to insert select at run time....????
java code to insert select at run time....????  java database code to retrieve data at runtime and please give codes for insert delete too.... using jsp and withot jsp   1)application.jsp: <%@ page import="java.sql.

Ads