Monday, 15 December 2014

// The "DecisionsWithStringsEx1" class.  Example 1, page 98.
// (from the Carter book)

// using the "equals" String method in decision-making.

import java.awt.*;
import hsa.Console;

public class DecisionsWithStringsEx1
{
    static Console c;           // The output console
   
    public static void main (String[] args)
    {
        c = new Console ();
       
        // given this declaration:
        String s = "Same";
        
        //1(a):
        s.equals ("Same");   // will this return true or false?
        //1(b):
        s.equals ("same");   // will this return true or false?
        //1(c):
        s.equals ("Same ");  // will this return true or false?
        
    } // main method
} // DecisionsWithStringsEx1 class

No comments:

Post a Comment