001 /** 002 * This is part of CSE 331 Problem Set 0. 003 */ 004 package ps0; 005 006 /** 007 * HolaWorld is like HelloWorld except it can say hello in Spanish! 008 */ 009 public class HolaWorld extends HelloWorld { 010 011 /** Greeting in Spanish */ 012 public static final String spanishGreeting = "Hola Mundo!"; 013 014 /** 015 * Shows what happens when the getGreeting() method 016 * of both HelloWorld and HolaWorld are invoked 017 */ 018 public static void main(String[] argv) { 019 020 // Create the Hello World objects. 021 HelloWorld myFirstHW = new HelloWorld(); 022 HolaWorld world = new HolaWorld(); 023 024 // Print out greetings 025 System.out.println(myFirstHW.getGreeting()); 026 System.out.println(world.getGreeing()); 027 } 028 029 /** 030 @return Returns a greeting (in Spanish). 031 */ 032 public String getGreeting() { 033 return spanishGreeting; 034 } 035 036 }