Assignment 2 ITP DOCX

Title Assignment 2 ITP
Author Shahzeb Habib
Pages 4
File Size 17.6 KB
File Type DOCX
Total Downloads 96
Total Views 542

Summary

Shahzeb Habib Prof. Ke Ziao ITN 120 (homework assignment Chapter2) March 3, 2016 2.14 Write an application that displays the numbers 1 to 4 on the same line, with each pair of adjacent numbers separated by one space, Use the following techniques: A, Use one System.out.println statement. B, Use four ...


Description

Shahzeb Habib Prof. Ke Ziao ITN 120 (homework assignment Chapter2) March 3, 2016 2.14 Write an application that displays the numbers 1 to 4 on the same line, with each pair of adjacent numbers separated by one space, Use the following techniques: A, Use one System.out.println statement. B, Use four System.out.print statements. C, Use one System.out.printf statement. Answers: A, public class Welcome 1 public static void main(String[] args) { System.out.println ("1, 2, 3, 4\n"); } B, public class Welcome 2 public static void main(String[] args) { System.out.print ("1, 2, 3, 4"); C, public class Welcome 3 public static void main(String[] args) { System.out.printf ("%d%d%d\n", 1, 2, 3, 4 );...


Similar Free PDFs