Guest User

Untitled

a guest
Sep 6th, 2013
43
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2.  * Spelling counts if you do Main then it will not work
  3.  * string is the return type
  4.  * **********************************************
  5.  *              BACON    BACON                  *
  6.  *              BACON    BACON                  *
  7.  *              BACON    BACON                  *
  8.  *              BACON    BACON                  *
  9.  *              BACON    BACON                  *
  10.  *              BACON    BACON                  *
  11.  *              BACON    BACON                  *
  12.  *                                              *
  13.  *                                              *
  14.  *     BACON                        BACON       *
  15.  *     BACON                        BACON       *
  16.  *          BACON BACON BACON BACON             *
  17.  *          BACON BACON BACON BACON             *
  18.  *                     BACON   \                *
  19.  *                      BACON  \                *
  20.  *                        BACON                 *
  21.  ************************************************
  22.  * Java is an object oriented program
  23.  * objects tell you what the thing should know.
  24.  * you can make a object of a class
  25.  * Concatonation is the child of another parent
  26.  * every class inherit the parent class
  27.  *
  28.  * String is a class
  29.  *
  30.  * primitives are never capatilized
  31.  * int
  32.  * double
  33.  * char
  34.  *
  35.  */
  36. public class concatonations {
  37.     public static void main (String [] args){
  38.         System.out.println("This class concatonation string");
  39.         String s = concatOne();
  40.         double d = concatTwo();
  41.         System.out.println( s + d); // this is concatonation
  42.     }
  43.    
  44.     public static String concatOne()
  45.     {
  46.     /*
  47.      * void is in place of the return type if you don't ever want a return type.
  48.      */
  49.     String alpha = " Awesome "; //literal strings are the ones that are in quotes
  50.     String beta = " Better ";
  51.     return(alpha + " " + beta); //the blue sign is the concatonation symbol.
  52.        
  53.     }
  54.    
  55.    
  56.     public static double concatTwo()
  57.     {
  58.         int first = 6;
  59.         double second = 10;
  60.         double third = 15.5;
  61.         System.out.println(" The sum of two numbers is " + (first + second));
  62.         return(first + second);
  63.                     //this +sign is not a concatonation sign
  64.         /**
  65.          * NOTICE int + double = double
  66.          * Any line after a return statement is not used.
  67.          */
  68.        
  69.        
  70.     }
  71. }
RAW Paste Data