Jump to content

  • Log In with Google      Sign In   
  • Create Account


Matthew Melendez

Member Since 02 Feb 2012
Offline Last Active Feb 20 2012 11:02 PM
-----

Topics I've Started

Java Class Constructor Question

02 February 2012 - 02:36 PM

Can anyone find any problems that make arise with this code?
Will there be a problem with an empty constructor like this?

package foo;


import java.awt.Image.*;
import java.awt.image.BufferedImage;
public class foo
{
   BufferedImage image = new BufferedImage(64,32,BufferedImage.TYPE_INT_ARGB);
  

	public foo()
	{
		//no code here
	}
	public void setRgb(int x, int y, int rgb)
	{
		image.setRGB(x,y,rgb);
	}
}

I want to be able to create a new foo object like so:
foo object = new foo();

and be able to do this:
object.setRgb(5,5,0x00000000)

PARTNERS