How to encapsulate height and width of an image with java.awt.Dimension object and pass it to a method like 235 x 265 -


java: how can encapsulate height , width java.awt.dimension object (in java) 235 x 265 , and pass method. passed integer array? if so, how? contributions highly appreciated.

objects meant used types variables, , can of course passed arguments methods. here's example:

public class dimensionprinter     public void printdimension(dimension d) {         system.out.println("here's dimension width : " + d.getwidth());         system.out.println("here's dimension height : " + d.getheight());     } } 

and here's example using above method:

public class main {     public static void main(string[] args) {         dimension dimension = new dimension(800, 600);         dimensionprinter printer = new dimensionprinter();         printer.printdimension(dimension);     } } 

(imports omitted)

this extremely basic stuff need understand before doing serious development, gui development, hard.

if learnt answer, it's sign should read introductory book java , oo. java tutorial read.


Comments

Popular posts from this blog

javascript - How to get current YouTube IDs via iMacros? -

c# - Maintaining a program folder in program files out of date? -

emulation - Android map show my location didn't work -