Picture objects

Picture objects - Picture objects - Creating a picture o...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Picture objects - Creating a picture o use new keyword new Picture(); o declare a variable can refer to it again this way Picture picture1 = new Picture(); o print information can print and store text description of object System.out.println(picture1); - Showing a picture o Option 1 Picture1.show(); o Option 2 Picture1.setVisible(true); o Creating it from a file Write as a string Sequence of characters “C:/intro-prog-java/mediasources/beach.jpg” Strings - String objects o Sequence of characters inside pair of double quotes “this is a string” constant when in this form o Create a new string object new String(“the characters”); o declare a variable String message = “You won!” Same as String message = string new - String methods o test.toUpperCase o test.length - strings cannot be changed o can be replaced by a new string (create and return new string) - Characters in strings o Stored using Unicode 16 bits per character
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/28/2011 for the course CSCI 053 taught by Professor Sibert during the Fall '10 term at GWU.

Page1 / 3

Picture objects - Picture objects - Creating a picture o...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online