SlideShare una empresa de Scribd logo
1 de 7
Enum   Supported by jdk1.5+
Enum ,[object Object],enum Maruti  //  enum type { Maruti800,Swift;  //  enum constants } ,[object Object]
An Enum is strictly a class-type ,[object Object],final class Maruti extends java.lang.Enum { public static final Maruti Maruti800; public static final Maruti Swift; public static Maruti[] values(); public static Maruti valueOf(java.lang.String); static {}; } ,[object Object],[object Object],[object Object],[object Object]
Enum ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],class Test { public static void main(String[]args) {   Maruti m1 = Maruti.SWIFT; Maruti m2=Maruti.MARUTI800; } } Output : I want red one. No color selected
Points To Notice ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Think of the following.. ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],What should be the output?? non-static block invoked Constructor invoked Static block invoked main
What about this.. ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]

Más contenido relacionado

Destacado

Protecting online data unit 1
Protecting online data unit 1Protecting online data unit 1
Protecting online data unit 1callum321
 
My Philosophy of Teaching July 11-last draft A
My Philosophy of Teaching July 11-last draft AMy Philosophy of Teaching July 11-last draft A
My Philosophy of Teaching July 11-last draft AJuanita V. Rodriguez
 
Evolución estelar
Evolución estelarEvolución estelar
Evolución estelarantonio_52
 
Relatório IBM X-Force ameaças e tendências de riscos
Relatório IBM X-Force ameaças e tendências de riscos Relatório IBM X-Force ameaças e tendências de riscos
Relatório IBM X-Force ameaças e tendências de riscos Alexandre Freire
 
El universo desde Eratóstenes a Newton
El universo desde Eratóstenes a NewtonEl universo desde Eratóstenes a Newton
El universo desde Eratóstenes a Newtonantonio_52
 
Zebra Waste Management Presentation
Zebra Waste Management PresentationZebra Waste Management Presentation
Zebra Waste Management PresentationYash Kajve
 
Forcelandia 2016 Wave App Development
Forcelandia 2016   Wave App DevelopmentForcelandia 2016   Wave App Development
Forcelandia 2016 Wave App DevelopmentSkip Sauls
 
Industrial communication 2016 English
Industrial communication 2016 EnglishIndustrial communication 2016 English
Industrial communication 2016 Englishifm electronic gmbh
 
Interface in java By Dheeraj Kumar Singh
Interface in java By Dheeraj Kumar SinghInterface in java By Dheeraj Kumar Singh
Interface in java By Dheeraj Kumar Singhdheeraj_cse
 
Philosophy of early childhood education 2
Philosophy of early childhood education 2Philosophy of early childhood education 2
Philosophy of early childhood education 2Online
 
Java OOP Programming language (Part 3) - Class and Object
Java OOP Programming language (Part 3) - Class and ObjectJava OOP Programming language (Part 3) - Class and Object
Java OOP Programming language (Part 3) - Class and ObjectOUM SAOKOSAL
 
C++ Files and Streams
C++ Files and Streams C++ Files and Streams
C++ Files and Streams Ahmed Farag
 

Destacado (18)

Protecting online data unit 1
Protecting online data unit 1Protecting online data unit 1
Protecting online data unit 1
 
Mapas mentales gerencia de proyectos
Mapas mentales gerencia de proyectosMapas mentales gerencia de proyectos
Mapas mentales gerencia de proyectos
 
My Philosophy of Teaching July 11-last draft A
My Philosophy of Teaching July 11-last draft AMy Philosophy of Teaching July 11-last draft A
My Philosophy of Teaching July 11-last draft A
 
Evolución estelar
Evolución estelarEvolución estelar
Evolución estelar
 
Relatório IBM X-Force ameaças e tendências de riscos
Relatório IBM X-Force ameaças e tendências de riscos Relatório IBM X-Force ameaças e tendências de riscos
Relatório IBM X-Force ameaças e tendências de riscos
 
El universo desde Eratóstenes a Newton
El universo desde Eratóstenes a NewtonEl universo desde Eratóstenes a Newton
El universo desde Eratóstenes a Newton
 
Tm t20
Tm t20Tm t20
Tm t20
 
Zebra Waste Management Presentation
Zebra Waste Management PresentationZebra Waste Management Presentation
Zebra Waste Management Presentation
 
Forcelandia 2016 Wave App Development
Forcelandia 2016   Wave App DevelopmentForcelandia 2016   Wave App Development
Forcelandia 2016 Wave App Development
 
Industrial communication 2016 English
Industrial communication 2016 EnglishIndustrial communication 2016 English
Industrial communication 2016 English
 
Mp10 pinpad bluetooth
Mp10 pinpad bluetoothMp10 pinpad bluetooth
Mp10 pinpad bluetooth
 
ET5x
ET5xET5x
ET5x
 
Interface in java By Dheeraj Kumar Singh
Interface in java By Dheeraj Kumar SinghInterface in java By Dheeraj Kumar Singh
Interface in java By Dheeraj Kumar Singh
 
Mc40 Zebra
Mc40 ZebraMc40 Zebra
Mc40 Zebra
 
Philosophy of early childhood education 2
Philosophy of early childhood education 2Philosophy of early childhood education 2
Philosophy of early childhood education 2
 
Java OOP Programming language (Part 3) - Class and Object
Java OOP Programming language (Part 3) - Class and ObjectJava OOP Programming language (Part 3) - Class and Object
Java OOP Programming language (Part 3) - Class and Object
 
C++ Files and Streams
C++ Files and Streams C++ Files and Streams
C++ Files and Streams
 
李聖傑 最近
李聖傑   最近李聖傑   最近
李聖傑 最近
 

Similar a Enum

Java Sorting CodeImplementing and testing all three sort algorithm.pdf
Java Sorting CodeImplementing and testing all three sort algorithm.pdfJava Sorting CodeImplementing and testing all three sort algorithm.pdf
Java Sorting CodeImplementing and testing all three sort algorithm.pdfforecastfashions
 
Aspect-Oriented Programming
Aspect-Oriented ProgrammingAspect-Oriented Programming
Aspect-Oriented ProgrammingAndrey Bratukhin
 
Csharp4 objects and_types
Csharp4 objects and_typesCsharp4 objects and_types
Csharp4 objects and_typesAbed Bukhari
 
(5) c sharp introduction_object_orientation_part_ii
(5) c sharp introduction_object_orientation_part_ii(5) c sharp introduction_object_orientation_part_ii
(5) c sharp introduction_object_orientation_part_iiNico Ludwig
 
Programming with Java: the Basics
Programming with Java: the BasicsProgramming with Java: the Basics
Programming with Java: the BasicsJussi Pohjolainen
 
PHP Built-in String Validation Functions
PHP Built-in String Validation FunctionsPHP Built-in String Validation Functions
PHP Built-in String Validation FunctionsAung Khant
 
Tiger: Java 5 Evolutions
Tiger: Java 5 EvolutionsTiger: Java 5 Evolutions
Tiger: Java 5 EvolutionsMarco Bresciani
 
In this page, we will learn about the basics of OOPs. Object-Oriented Program...
In this page, we will learn about the basics of OOPs. Object-Oriented Program...In this page, we will learn about the basics of OOPs. Object-Oriented Program...
In this page, we will learn about the basics of OOPs. Object-Oriented Program...Indu32
 
Java New Programming Features
Java New Programming FeaturesJava New Programming Features
Java New Programming Featurestarun308
 

Similar a Enum (20)

Java 5 Features
Java 5 FeaturesJava 5 Features
Java 5 Features
 
JAVA LESSON-02.pptx
JAVA LESSON-02.pptxJAVA LESSON-02.pptx
JAVA LESSON-02.pptx
 
Operator overloading
Operator overloading Operator overloading
Operator overloading
 
Java Sorting CodeImplementing and testing all three sort algorithm.pdf
Java Sorting CodeImplementing and testing all three sort algorithm.pdfJava Sorting CodeImplementing and testing all three sort algorithm.pdf
Java Sorting CodeImplementing and testing all three sort algorithm.pdf
 
J2ee standards > CDI
J2ee standards > CDIJ2ee standards > CDI
J2ee standards > CDI
 
Java 14
Java 14 Java 14
Java 14
 
BIT211_2.pdf
BIT211_2.pdfBIT211_2.pdf
BIT211_2.pdf
 
Aspect-Oriented Programming
Aspect-Oriented ProgrammingAspect-Oriented Programming
Aspect-Oriented Programming
 
Basic_Java_02.pptx
Basic_Java_02.pptxBasic_Java_02.pptx
Basic_Java_02.pptx
 
Csharp4 objects and_types
Csharp4 objects and_typesCsharp4 objects and_types
Csharp4 objects and_types
 
Applets in java
Applets in javaApplets in java
Applets in java
 
(5) c sharp introduction_object_orientation_part_ii
(5) c sharp introduction_object_orientation_part_ii(5) c sharp introduction_object_orientation_part_ii
(5) c sharp introduction_object_orientation_part_ii
 
Ast transformation
Ast transformationAst transformation
Ast transformation
 
J Unit
J UnitJ Unit
J Unit
 
Programming with Java: the Basics
Programming with Java: the BasicsProgramming with Java: the Basics
Programming with Java: the Basics
 
Unit 7 Java
Unit 7 JavaUnit 7 Java
Unit 7 Java
 
PHP Built-in String Validation Functions
PHP Built-in String Validation FunctionsPHP Built-in String Validation Functions
PHP Built-in String Validation Functions
 
Tiger: Java 5 Evolutions
Tiger: Java 5 EvolutionsTiger: Java 5 Evolutions
Tiger: Java 5 Evolutions
 
In this page, we will learn about the basics of OOPs. Object-Oriented Program...
In this page, we will learn about the basics of OOPs. Object-Oriented Program...In this page, we will learn about the basics of OOPs. Object-Oriented Program...
In this page, we will learn about the basics of OOPs. Object-Oriented Program...
 
Java New Programming Features
Java New Programming FeaturesJava New Programming Features
Java New Programming Features
 

Más de Bharat17485

Channel Based Io
Channel Based IoChannel Based Io
Channel Based IoBharat17485
 
Developing Multithreaded Applications
Developing Multithreaded ApplicationsDeveloping Multithreaded Applications
Developing Multithreaded ApplicationsBharat17485
 
Interfaces & Abstract Classes
Interfaces & Abstract ClassesInterfaces & Abstract Classes
Interfaces & Abstract ClassesBharat17485
 
Exceptions & Its Handling
Exceptions & Its HandlingExceptions & Its Handling
Exceptions & Its HandlingBharat17485
 
Primitive Wrappers
Primitive WrappersPrimitive Wrappers
Primitive WrappersBharat17485
 
Regular Expression
Regular ExpressionRegular Expression
Regular ExpressionBharat17485
 
Stream Based Input Output
Stream Based Input OutputStream Based Input Output
Stream Based Input OutputBharat17485
 
Applying Generics
Applying GenericsApplying Generics
Applying GenericsBharat17485
 

Más de Bharat17485 (12)

Channel Based Io
Channel Based IoChannel Based Io
Channel Based Io
 
Core Java
Core JavaCore Java
Core Java
 
Developing Multithreaded Applications
Developing Multithreaded ApplicationsDeveloping Multithreaded Applications
Developing Multithreaded Applications
 
Interfaces & Abstract Classes
Interfaces & Abstract ClassesInterfaces & Abstract Classes
Interfaces & Abstract Classes
 
Exceptions & Its Handling
Exceptions & Its HandlingExceptions & Its Handling
Exceptions & Its Handling
 
Jstl & El
Jstl & ElJstl & El
Jstl & El
 
Primitive Wrappers
Primitive WrappersPrimitive Wrappers
Primitive Wrappers
 
Regular Expression
Regular ExpressionRegular Expression
Regular Expression
 
Stream Based Input Output
Stream Based Input OutputStream Based Input Output
Stream Based Input Output
 
String Handling
String HandlingString Handling
String Handling
 
Swing
SwingSwing
Swing
 
Applying Generics
Applying GenericsApplying Generics
Applying Generics
 

Enum

  • 1. Enum Supported by jdk1.5+
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.