FileOutputStream fileOutStream = new FileOutputStream(file); ObjectOutputStream output = new ObjectOutputStream(fileOutStream);
enum declaration prohibited?enum for the colors RED, BLUE, and GREEN?
public enum Color{
RED, BLUE, GREEN;
}
package com.java.enums;
/*
date_created: February 13, 2015/
date_updated: February 3, 2015 */
interface externalTechnology {
void implement();
}
public class EnumExample implements externalTechnology {
public enum Company {
EBAY, PAYPAL, GOOGLE, YAHOO, ATT
}
Company cName;
public EnumExample(Company cName) {
this.cName = cName;
}
public void companyDetails() {
switch (cName) {
case EBAY: {
System.out.println("Ebay, the Biggest Market Place in the World.");
break;
}
case PAYPAL: {
System.out.println("Paypal, the simplest way to manage Money.");
break;
}
case GOOGLE: {
System.out.println("Google: most accurate search results.");
break;
}
case YAHOO: {
System.out.println("Yahoo, the first Web Portal Company.");
break;
}
default: {
System.out.println("Google - most accurate search results.");
break;
}
}
}
public static void main(String[] args) {
EnumExample ebay = new EnumExample(Company.EBAY);
ebay.companyDetails();
EnumExample paypal = new EnumExample(Company.PAYPAL);
paypal.companyDetails();
EnumExample google = new EnumExample(Company.GOOGLE);
google.companyDetails();
EnumExample yahoo = new EnumExample(Company.YAHOO);
yahoo.companyDetails();
EnumExample att = new EnumExample(Company.ATT);
att.companyDetails();
ebay.implement();
}
public void implement() {
System.out.println("These companies need to implement an external technology.");
}
}
// ----- program output
/*
Ebay, the Biggest Market Place in the World.
Paypal, the simplest way to manage Money.
Google: most accurate search results.
Yahoo, the first Web Portal Company.
Google - most accurate search results.
These companies need to implement an external technology.
*/
values() return?