Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Main {
- public static void main(String[] args) {
- //primitive types - simple, hold one piece of information, take one memory location
- //Java is strictly typed
- //int, double, boolean
- //integer types
- //byte - 8bit, short - 16, int - 32bit, long - 64bit
- //float types
- //float, double
- //boolean
- //char
- //Reference Types, or Object types
- //String
- int num1, num2, sum;//declaration
- String fName="Charlie",lName="Gorrill";//assignment
- String fullName=fName+" "+lName;//concatenation
- System.out.println(fullName);
- num1=15;//assignment statement or initialization
- num2=27;
- sum=num1+num2;//sum operation and assignment
- //p(cast)mdas
- double average=0.0;
- int num3, num4, num5, num6, num7;
- num3=10;
- num4=23;
- num5=32;
- num6=12;
- num7=65;
- average=(double)(num3+num4+num5+num6+num7)/5;
- /*+++++++++++++++++++++++++++++++++++++++++++*/
- /*++++++++++Plus Test Lab Here+++++++++++++++*/
- /*+++++++++++++++++++++++++++++++++++++++++++*/
- System.out.println ("This is a long string that is the " +
- "concatenation of two shorter strings.");
- System.out.println ("The first computer was invented about" + 55 +
- "years ago.");
- System.out.println ("8 plus 5 is " + 8 + 5);
- System.out.println ("8 plus 5 is " + (8 + 5));
- System.out.println (8 + 5 + " equals 8 plus 5.");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement