Advertisement
MrDoyle

3) Strings

Jan 14th, 2021
487
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.49 KB | None | 0 0
  1. public class Main {
  2.  
  3.     public static void main(String[] args){
  4.         int myInt = 7;
  5.         String text = "Hello";
  6.  
  7.         String blank = " ";
  8.  
  9.         String name = "Bob";
  10.  
  11.         String greeting = text + blank + name;
  12.  
  13.         System.out.println (greeting);
  14.  
  15.         System.out.println("Hello" + " " + "Bob");
  16.  
  17.         System.out.println("My integer is: "+ myInt);
  18.  
  19.         double myDouble = 7.8;
  20.  
  21.         System.out.println("My number is: " + myDouble + ".");
  22.     }
  23.  
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement