Advertisement
Guest User

Untitled

a guest
Jun 25th, 2019
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. /*
  2. 分別依如下指示列印如下效果:
  3. 1 2 3 4
  4. - 4個數字之間皆有一個空格
  5. - (a) 限定只用一個println指令
  6. - (b) 限定只用一個print指令
  7. - (c) 限定用4個println指令
  8. */
  9.  
  10. public class HW1 {
  11. public static void main (String[] args) {
  12. System.out.println("1 2 3 4");
  13. System.out.print(1);
  14. System.out.print(" 2");
  15. System.out.print(" 3 ");
  16. System.out.print(4);
  17. System.out.println();
  18. System.out.print(1+" "+2+" "+3+" "+4);
  19.  
  20. }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement