Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

pointer printing instead of information

$
0
0
Hi
I have 2 classes I want to retrieve the information from 1 and print to the console the problem is it prints its pointer I knoe theirs away of changing this but I've gone blank to this technique can anyone help me.

public class Face
{

	private float x;
	private float y;
	private float z;
	
	public Face() 
	{
		// TODO Auto-generated constructor stub
		super();
		x = 0.0f;
		y = 0.0f;
		z = 0.0f;
	}
	
	public Face( float xx, float yy, float zz )
	{
		super();
		x = xx;
		y = yy;
		z = zz;
	}

}

public class LoadData 
{
	
	private Face[]fData; 
	
		
	public LoadData() 
	{
		// TODO Auto-generated constructor stub
		super();
		fData = new Face[ 3 ];
		faceData();
		iterate();
	}
	
	public void faceData()
	{
		fData[ 0 ] = new Face( 1.0f, 2.0f, 3.0f );
		fData[ 1 ] = new Face( 4.0f, 5.0f, 6.0f );
		fData[ 2 ] = new Face( 7.0f, 8.0f, 9.0f );
		
	}
	
	public void iterate()
	{
		for( int i = 0; i < fData.length; i++ )
		{
			System.out.println( "Face Data: " + fData[ i ] );
		}
	}
	

	/**
	 * @param args
	 */
	public static void main(String[] args)
	{
		// TODO Auto-generated method stub
		new LoadData();
	}

}




it prints

Face Data: faceData2.Face@7d8a992f
Face Data: faceData2.Face@164f1d0d
Face Data: faceData2.Face@23fc4bec

Viewing all articles
Browse latest Browse all 51036

Trending Articles