lab & assignment
This commit is contained in:
22
labs/lab2/plusTest.java
Normal file
22
labs/lab2/plusTest.java
Normal file
@ -0,0 +1,22 @@
|
||||
// *******************************************************************
|
||||
// PlusTest.java
|
||||
//
|
||||
// Demonstrate the different behaviors of the + operator
|
||||
// *******************************************************************
|
||||
public class PlusTest
|
||||
{
|
||||
// -------------------------------------------------
|
||||
// main prints some expressions using the + operator
|
||||
// -------------------------------------------------
|
||||
public static void main (String[] args)
|
||||
{
|
||||
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.");
|
||||
System.out.println ("Ten robins plus 13 canaries is "+(10+13)+" birds.");
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user