Home Answers Viewqa Java-Beginners ArrayList question plz solve it

 
 


nisanth
ArrayList question plz solve it
1 Answer(s)      a year and 6 months ago
Posted in : Java Beginners

An arraylist object stores an Emp Object, where there is name,age,address of the employee is stored,

And i want to access the data in the basis of age based?

Provide answer to the question with an example..

View Answers

November 5, 2011 at 3:47 PM


import java.util.*;
class EmployeeData 
{
    String name;
    String address;
    int age;
    EmployeeData(String name,String address,int age){
        this.name=name;
        this.address=address;
        this.age=age;
    }
    public String getName(){
        return name;
    }
    public String getAddress(){
        return address;
    }
    public int getAge(){
        return age;
    }

    public static void main(String []args){
        ArrayList<EmployeeData> list=new ArrayList<EmployeeData>();
        list.add(new EmployeeData("A","Delhi",22));
        list.add(new EmployeeData("B","Mumbai",23));
        list.add(new EmployeeData("C","Agra",24));
        list.add(new EmployeeData("D","Kolkata",25));
        list.add(new EmployeeData("E","Goa",22));
        list.add(new EmployeeData("F","Chennai",23));
        list.add(new EmployeeData("G","Lucknow",22));
        list.add(new EmployeeData("H","Mathura",25));
        list.add(new EmployeeData("I","Delhi",23));
        list.add(new EmployeeData("J","Kanpur",24));

        Scanner input=new Scanner(System.in);
        System.out.print("Enter age: ");
        int a=input.nextInt();
        for(EmployeeData e : list){
            if(a==e.getAge()){
                System.out.println(e.getName()+" \t "+e.getAddress()+" \t "+e.getAge());
            }
        }
    }
}









Related Pages:
ArrayList question plz solve it
ArrayList question plz solve it  An arraylist object stores an Emp Object, where there is name,age,address of the employee is stored, And i want to access the data in the basis of age based? Provide answer to the question
plz help meto solve this question
plz help meto solve this question  for a file that exist what will be the length() method in the file class return
plz help me for this question
plz help me for this question  Apply simplex procedure to solve the L.P.P. maximize z = 3x1 + 4x2 subject to 5x1 + 4x2 â?¤ 200; 3x1 + 5x2 â?¤ 150; 5x1 + 4x2 â?¥ 100; 8x1 + 4x2 â?­â?¥ 80, x1 â?¥ 0, x2 â?¥ 0
Question in Create Arraylist ?
Question in Create Arraylist ?  Good Morning EveryOne I have Q in Java - and if any One have the Answers please tall me ??!! Question...¢?? to solve the phone directory problem defined above. Thanks a lot
plz solve my query?
plz solve my query?  how to remove all the options from select control in html using java script?   JavaScript remove all items <html> <script language="javascript" > function removeAllItems(selectbox
plz anyone can solve my
plz anyone can solve my  creat an applet prog which accepts the details of 10 customers like name , address , city , ect. and display it   import java.awt.*; import javax.swing.*; import java.awt.event.*; import
help me to solve this question
help me to solve this question  Write a program that inputs a series of integers into an array. The numbers are in the range 0 to 100. Calculate and display : a) The Largest number b) The Smallest Number c)The sum of the numbers
help me to solve this question...
help me to solve this question...  Given below is a class definition for Book. Type and compile the class, and answer the following questions: class Book { String title; //bookâ??s title double price; //bookâ??s
arraylist
invalid input . if u add more than 5 employees an exaception must be thrown. Plz
solve my question shortly
solve my question shortly  <html> <head> <script> function checkphoneNumber(number){ if(/[^\d ]/.test(number)){ alert('It should contain numbers [0-9] only!'); document.getElementById
help me to solve this question
help me to solve this question   A user needs to key in data into system in order to save data into array. The data are: a. Lecturer ID, Lecturer name, School, course code, course name, session, semester A user can edit the data
arraylist of an arraylist
arraylist of an arraylist  Can anyone suggest me how to use arraylist of an arraylist?? how to put data into it and get data from it???? becoz i want to make rows and column dynamic which can grow as per requirement?????/ plz
plz solve this program - Java Interview Questions
plz solve this program  write a program to out put this resault using two dimensional array this is an image of the reasult: http://www.4shared.com/file/154846107/dc2f1ac1/_2__Untitled-1.html so help me
OCI Connectivity For Oracle Plz Solve This Error
OCI Connectivity For Oracle Plz Solve This Error  import java.io.*; import java.sql.*; import java.lang.*; import oracle.jdbc.OracleDriver; public...) { e.printStackTrace(); } } } ---> I found Error below how i can solve this error plz
OCI Connectivity For Oracle Plz Solve This Error
OCI Connectivity For Oracle Plz Solve This Error  import java.io.*; import java.sql.*; import java.lang.*; import oracle.jdbc.OracleDriver; public...) { e.printStackTrace(); } } } ---> I found Error below how i can solve this error plz
how do i solve this question?
how do i solve this question?  1.Define a class named Circle with the following properties: a) An integer data field named radius with protected access modifier, and a String data field named colour with private access modifier
Plz give me code for this question
Plz give me code for this question  Program to find depth of the file in a directory and list all files those are having more number of parent directories
need to solve the below question - Java Beginners
need to solve the below question  I need to write an application that uses the circle class.it must read a radius of a circle from the user .create a circle object and return the object
please help me to solve this question about array
please help me to solve this question about array  write a program thatt stores vowels (a,e,i,o and u)in an array. Ask the user to enter any character. The program should ignore the case of that character (uppercase or lowercase
ArrayList object
ArrayList object  i have am ArrayList object it containg data base records in it, now i want to display this ArrayList object data in my jsp programe, plz help me
question
question   sir plz tell me what should i give in title box. just i want java program for the question typed in this area
question
question   sir plz tell me what should i give in title box. just i want java program for the question typed in this area
question
question  how to solve the problem of The requested resource is not available+java+eclipse
ans plz
) throws Exception { ArrayList list1=new ArrayList(); ArrayList list2=new ArrayList(); PipedWriter pw1 = new PipedWriter(); PipedReader pr1 = new PipedReader
vector and arraylist
vector and arraylist    suppose i have class A { public static arrylist a1(){} class B{ public static vector b1() {} } my question is how to class B method in Class A and how to get vector object values in class A without
ArrayList in java
ArrayList in java  sir i have a class Student.it contains id,name,marks of students and a parameteraised constructor.now i created an arraylist...); a.add(s3); my question is...how can we sort the students by their marks?how
question
question  how to solve the below problem com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Column 'emp_id' in field list is ambiguous
Solve it
Solve it  How to calculate the value which contains oparator and operand both using command line argument
question
question  Good afternoon Sir, how to solve the problem of The requested resource is not available+java+eclipse if you can play a demo
question
question  how to solve this problem com.mysql.jdbc.MysqlDataTruncation: Data truncation: Incorrect time value: ' 0:34:13 PM' for column 'afternoon' at row 1
solve this
solve this   Create a student class. The student object should have studentid, studentname, subject and marks as properties. Also generate the getter and setter methods. Create 5 objects of this class and populate values
interview question plz help me and thers
interview question plz help me and thers  A college is good if it satisfies the following conditions: 1.Its number of students is greater than 1000. 2.If the name ends wih a character 'e', then it should not start with character
question
question  how to solve this problem The import jade.core.Agent cannot be resolved   This means that the above package does not not exist in your jdk. So download jar file that contains this package and put the jar file
question
/) is not available.** how tdo i solve this.please help me to run my project please give
Question
Question  sir I am creating a user defined custom tag in net beans ide but I am unable to run the code sucessfully . I got internal server error plz help me   Please visit the following links: http://www.roseindia.net
Plz help me with this Question - Java Beginners
Plz help me with this Question  this is java code ------------------------- Consider the following code: int [ ] a = [1, 2, 3]; Object o ="123"; String t = "12"; String w = t + "3"; Boolean b = o.equals (a); Boolean b2
Plz help with third Question - Java Beginners
Plz help with third Question  1)- Specify and implement a procedure that determines whether or not a string is a palindrome. (A palindrome reads the same backward and forward; an example is "deed
question
question  Dear Sir, How do i solve the following problems , i am using jdk1.6.0_22 and eclipse Helios , please help me ................ Access restriction: The type Player is not accessible due to restriction on required
arraylist with session - JSP-Servlet
arraylist with session  hi how can an arraylist stored in session.. and also how will it access?? pls give me the details with sample code..   Hi friend, Code to solve the problem : Thanks
ARRAYLIST CODE - Java Beginners
ARRAYLIST CODE  HELLO SIR,I AM VERY NEW TO JAVA FIELD,HOW TO READ ELEMENTS FROM TWO ARRAYLIST AND PRINT THE ELEMENTS WHICH ARE COMMON TO TWO ARRAYLIST IN ONE LINE AND OTHER IN NEXT LINE,PLZ HELP ME.IN ADVANCE THANK U VERY
Clear Question plz et me know immediately - Java Beginners
Clear Question plz et me know immediately   Hi Deepak your application is good,pls modify this application and let me know My problem is that, Steps: 1:- A form have three 3 button delete,insert,edit. 2
arraylist problem - Java Beginners
arraylist problem  Hello.... I wrote the following code for adding...{ ArrayList al = new ArrayList(); for(int i=0;i<10;i++){ String event...); } for(int k=0;k  hi i am not able to under stand ur question u send
PLZ Need some help on the 2nd part of this question...Someone please help !!!!
PLZ Need some help on the 2nd part of this question...Someone please help !!!!  write an application that displays a menue of three items in a restaurant as follows: 1.Cheeseburger 4.99 2.Pepsi 2.00 3.Chips 0.75 prompt the user
sir i,have a assignment for these question plz help me sir - JavaMail
sir i,have a assignment for these question plz help me sir   1.Design a Java interface for ADT Stack. Develop two different classes that implement this interface, one using array and the other using linked-list. Provide
arraylist problem - JSP-Servlet
arraylist problem  hello thanx a lot for ur reply. i m sending u...=st1.executeQuery(sql1); ArrayList dstName=new ArrayList(); ArrayList Code=new ArrayList(); ArrayList teamLeader=new
arraylist
arraylist   Using arraylist class , what type of exception are throws, how can write a java programe   An ArrayList can throw... ArraylistException { void buildAlphabet() { ArrayList list = new ArrayList
Plz send me answer quckly
Plz send me answer quckly  Respected Sir, myself is pavan shrivastava.i want ask a question that is ( we can't create object of interface then how would possible to create object
arraylist
arraylist  Hi How can we eliminet duplicate element from arraylist? How can we find highest salary from arraylist ? How can we highest key value pair from map? Thanks Kalins Naik   Remove duplicates from Arraylist
arraylist
arraylist  Hi how can we eliminet duplicate element from arraylist in java? how can we achieve data abstrcation and encapulation in java? how many type of modifier are there in java? Thanks kalins anik   Remove

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.