Java program for changeable wrapper class

By: Issac Emailed: 1599 times Printed: 2045 times    

Latest comments
By: rohit kumar - how this program is work
By: Kirti - Hi..thx for the hadoop in
By: Spijker - I have altered the code a
By: ali mohammed - why we use the java in ne
By: ali mohammed - why we use the java in ne
By: mizhelle - when I exported the data
By: raul - no output as well, i'm ge
By: Rajesh - thanx very much...
By: Suindu De - Suppose we are executing

In this tutorial we are going to see a changeable wrapper class example. In this example We have file named Here we want arraylist, list. So we have to import util package.We can use import java.util.ArrayList; , import java.util.List; in this example..

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

class Values {
  private int s;

  public Values(int x) 
    s = x;

  public int getNumber() 
    return s;

  public void setNumber(int s) 
    this.s = s;

  public void increment() 

  public String toString()
    return Integer.toString(s);

public class MainClass

  public static void main(String[] args)
    List list = new ArrayList();
    for (int i = 0; i < 10; i++)
      list.add(new Values(i));
    for (int i = 0; i < list.size(); i++)
      ((Values) list.get(i)).increment();




Java Home | All Java Tutorials | Latest Java Tutorials

Sponsored Links

If this tutorial doesn't answer your question, or you have a specific question, just ask an expert here. Post your question to get a direct answer.

Bookmark and Share


Be the first one to add a comment

Your name (required):

Your email(required, will not be shown to the public):

Your sites URL (optional):

Your comments:

More Tutorials by Issac
Save/Write/Read image file from/to a database using Java program
How to modify the objects using java classes
Java program for Cloning
Java program for changeable wrapper class
A tutorial on Chat Server and Chat Client in
Chat Server in
Chat client in
How to open and read an XML file in
How to create an XML file in
XML and
How to create an XML file in VB.NET using Dataset
Multi Threaded Client Socket Programming in
Multi Threaded Server Socket Programming in
Multi threaded Socket Programming in
Client Socket Program sample in

More Tutorials in Java
Update contents of a file within a jar file
Tomcat and httpd configured in port 8080 and 80
Java File
Java String
Count number of vowels, consonants and digits in a String in Java
Reverse a number in Java
Student marks calculation program in Java
Handling Fractions in Java
Calculate gross salary in Java
Calculate average sale of the week in Java
Vector in Java - Sample Program
MultiLevel Inheritance sample in Java
Multiple Inheritance sample in Java
Java program using Method Overriding
Java program to check if user input is an even number

More Latest News
Most Viewed Articles (in Java )
How to Send SMS using Java Program (full code sample included)
wait(), notify() and notifyAll() in Java - A tutorial
How to use Iterator in Java
Using StringTokenizer in Java
Vector example in Java
Method Overriding in Java
FileReader and FileWriter example program in Java
Garbage Collection in Java
How to use ArrayList in Java
Multiple Inheritance sample in Java
Read from a COM port using Java program
Why java is important to the Internet
Method Overloading (function overloading) in Java
Use of return statement in Java
Using One-Dimensional Arrays in Java
Most Emailed Articles (in Java)
Creating Users and Passwords with Tomcat using tomcat-users.xml
Vector in Java - Sample Program
Java program to display numbers from 1 to 10 on Applet
HTTPS Java - URL Connection program. Using HttpsURLConnection
What is a report design in JasperReports?
Java scripting embedded in HTML.
Recursion in java
The Basic Structure of a Simple Java program
Reverse a number in Java
Draw a bar chart in Java
Iterate a List in Java
inheritance in Java
TCP Server and TCP Client in Java
Java program for Map
Getting Started with Java