JPVNotes2-Output

JPVNotes2-Output - Console Output in Java Notes Supplement...

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

View Full Document Right Arrow Icon
Console Output in Java Notes Supplement CS 1054 Introduction to Programming in Java Spring 2008
Background image of page 1

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

View Full DocumentRight Arrow Icon
Introduction to Object-Oriented Programming 1: Output Slide 2 print() and println() So far, we’ve used System.out.print and  System.out.println for output With a single argument (string or numeric value) println() if we require a new line at the end  of the output print() to stay on the current output line
Background image of page 2
Introduction to Object-Oriented Programming 1: Output Slide 3 Printing values around strings Suppose we wanted to print the values of two  variables, numCones (int) and unitPrice (double),  in a neat message e.g.,  sold 5 cones at 2.50 each. Using print and println, System.out.print("sold " ); System.out.print( numCones ); System.out.print( " cones at " ); System.out.print( unitPrice ); System.out.println(" each." );
Background image of page 3

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

View Full DocumentRight Arrow Icon
Introduction to Object-Oriented Programming 1: Output Slide 4 String concatenation
Background image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 04/02/2008 for the course CS 1054 taught by Professor Dpmcpherson during the Spring '08 term at Virginia Tech.

Page1 / 10

JPVNotes2-Output - Console Output in Java Notes Supplement...

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

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