Home | Gaming | Programming | Play Online | Contact | Keyword Query
Games++ Games & Game Programming

GAMES++
Games++ Home
Games++ Gaming
Games++ Programming
Beta Testing Games
Free Online Games
Hints & Cheats

BROWSER UTILITIES
E-mail This Page
Add to Favorites

SITE SEARCH

Web Games++

AFFILIATES
Cheat Codes
Trickster Wiki
Game Ratings
Gameboy Cheats
PlayStation Cheats
BlackBerry Games
Photoshop Tutorials
Illustrator Tutorials
ImageReady Tutorials

ADVERTISEMENT

ADVERTISEMENT

How To Create A Method with Unknown Number of Parameters

Java How To: Source Code

You pass an array of Objects.

public class Howto 
{
	public static void main(String args[]) 
	{
		Howto howto = new Howto();
		howto.myMethod(new Object[] {"value 1", new Integer(2), "value n"} );
	}

	public void myMethod(Object parms[]) 
	{
		for (int i=0; i < parms.length; i++) 
			System.out.println(parms[i]);
	}
}

Copyright © 1998-2007, Games++ All rights reserved. | Privacy Policy