Java program for changeable wrapper class

By: Issac Emailed: 1700 times Printed: 2205 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)
Recursion in java
XML and Java - Parsing XML using Java Tutorial
Using StringTokenizer in Java
Abstract classes in Java
The Basic Structure of a Simple Java program
Transient vs Volatile modifiers in Java
Read from a COM port using Java program
Count number of vowels, consonants and digits in a String in Java
append() in Java
What is Java?
InetAddress Example program in Java
Type Casting in Java
Garbage collection and Finalize() method
Student marks calculation program in Java
Most Emailed Articles (in Java)
Integer: byte, short, int, and long data types in Java
Java program for Map
What is a report design in JasperReports?
What is UTF-8?
java.lang.reflect package
CharSequence Interface in Java
Default Values for Data Types in Java
New Features Added by Java
BitSet example in Java
TreeMap example in Java
HashMap example in Java
iterator() and hasNext() in Java
delete() and deleteCharAt() in Java
wait(), notify() and notifyAll() in Java - A tutorial
call() and synchronized keyword - When and how to use in Java