Fundamental of Java Programming

Slides:



Advertisements
Similar presentations
1 Classes and Objects in Java Basics of Classes in Java.
Advertisements

Written by: Dr. JJ Shepherd
CSI 3125, Preliminaries, page 1 Polymorphism, Virtual function.
Java Annotations. Annotations  Annotations are metadata or data about data. An annotation indicates that the declared element should be processed in.
Intro to OOP with Java, C. Thomas Wu Inheritance and Polymorphism
Lab#1 (14/3/1431h) Introduction To java programming cs425
Objects and Classes First Programming Concepts. 14/10/2004Lecture 1a: Introduction 2 Fundamental Concepts object class method parameter data type.
OOP in Java Nelson Padua-Perez Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
What is a class? a class definition is a blueprint to build objects its like you use the blueprint for a house to build many houses in the same way you.
ASP.NET Programming with C# and SQL Server First Edition
Introduction to Classes and Objects CS-2303, C-Term Introduction to Classes and Objects CS-2303 System Programming Concepts (Slides include materials.
OOP in Java Fawzi Emad Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
1 Chapter 8 Objects and Classes. 2 Motivations After learning the preceding chapters, you are capable of solving many programming problems using selections,
Multiple Choice Solutions True/False a c b e d   T F.
CSE 331 Software Design & Implementation Hal Perkins Autumn 2012 Java Classes, Interfaces, and Types 1.
Java Class Syntax CSIS 3701: Advanced Object Oriented Programming.
Programming Pillars Introduction to Object- Oriented Programming.
JAVA Tokens. Introduction A token is an individual element in a program. More than one token can appear in a single line separated by white spaces.
CSC1401 Classes - 2. Learning Goals Computing concepts Adding a method To show the pictures in the slide show Creating accessors and modifiers That protect.
Working With Objects Tonga Institute of Higher Education.
ICBT  Basura Ramanayaka  Eshani werapitiya  Hasitha Dananjaya.
CreatingClasses-SlideShow-part41 Creating Classes part 4 Barb Ericson Georgia Institute of Technology Dec 2009.
Introduction to Object-Oriented Programming Lesson 2.
Today… “Hello World” ritual. Brief History of Java & How Java Works. Introduction to Java class structure. But first, next slide shows Java is No. 1 programming.
Java Annotations. Annotations  Annotations are metadata or data about data. An annotation indicates that the declared element should be processed in.
Chapter 5 Classes and Methods II Lecture Slides to Accompany An Introduction to Computer Science Using Java (2nd Edition) by S.N. Kamin, D. Mickunas, E.
Object orientation and Packaging in Java Object Orientation and Packaging Introduction: After completing this chapter, you will be able to identify.
AP Java Ch. 4 Review Question 1  Java methods can return only primitive types (int, double, boolean, etc).
1.1: Objects and Classes msklug.weebly.com. Agenda: Attendance Let’s get started What is Java? Work Time.
Topics Instance variables, set and get methods Encapsulation
SESSION 1 Introduction in Java. Objectives Introduce classes and objects Starting with Java Introduce JDK Writing a simple Java program Using comments.
Andrew(amwallis) Classes!
Modern Programming Tools And Techniques-I
Topic: Classes and Objects
Advanced Programing practices
Concepts of Object Oriented Programming
More on Java Generics Multiple Generic Types Bounded Generic Types
Classes and Objects in Java
Object Oriented Programming using Java - Class Instance Variables
Classes and Objects in Java
Classes and Objects in Java
Chapter 5 Classes.
Pointers and Pointer-Based Strings
Barb Ericson Georgia Institute of Technology Dec 2009
Introduction to Objects
Interfaces.
Abstract Data Types and Encapsulation Concepts
Object Oriented Programming (OOP) LAB # 8
Pass by Reference, const, readonly, struct
Your First Java Application
An Introduction to Java – Part II
Java Programming Language
Interfaces.
Constructors and Other Tools
Reference Parameters.
Java – Inheritance.
CS2011 Introduction to Programming I Objects and Classes
Java Programming Course
Workshop for Programming And Systems Management Teachers
Pointers and Pointer-Based Strings
CIS 199 Final Review.
Java Programming Language
Lab4 problems More about templates Some STL
Templates Generic Programming.
Unit-1 Introduction to Java
Corresponds with Chapter 5
INTERFACES Explained By: Sarbjit Kaur. Lecturer, Department of Computer Application, PGG.C.G., Sector: 42, Chandigarh.
Introduction to Objects
Introduction to Classes and Objects
Presentation transcript:

Fundamental of Java Programming Marwadi Education Foundation’s Group of Institutions Faculty of Computer Applications MCA Sem- III Fundamental of Java Programming (630002) Unit – 5 Annotations

Introduction Sun Microsystem added the features like annotation to make the development easier and more efficient in jdk 5. The main objective to develop the annotations is to make the development easier. Annotations behaves like the meta. The literal meaning of meta data is data about data. Java also signifies this meaning. Annotations are like meta data, means you are free to add your code and can also apply them to variables, parameters, fields type declarations, methods and constructors.

Introduction Annotation is the way of associating the program elements with the meta tags so that the compiler can extract program behavior to support the annotated elements to generate interdependent code when necessary.

Fundamentals of annotations While going through the annotations you should consider two things. The first one is the "annotation" itself and second one is the "annotations types". An annotation is the meta tag, used to give some life to the code you are using. While annotation type is used to define annotations so that you can use them while creating your own custom annotations.

Fundamentals of annotations An annotation type definition appends an "at" @ sign at the start of the interface keyword with the annotation name. On the other hand, an annotation includes the "at" @ sign followed by the annotation type. You can also add the data within the parenthesis after the annotation name. Lets illustrate the concept more clearly by using some examples.

Fundamentals of annotations Defining an annotation (Annotation type) public @interface Example { String showSomething(); } Annotating the code (Annotation) Example (showSomething="Hi! How r you") public void anymethod() { .... }

Annotation Types: Three types of annotations types are there in java. (1) Marker: Marker annotations does not contain any elements except the name itself. The example given below clarifies the concept of marker. Example: public @interface Example { } Usage: @Example public void anymethod() { ------------ }

Annotation Types: (2) Single-value: This type of elements provide only single value. It means that these can be represented with the data and value pair or we can use the shortcut syntax (just by using the value only within the parenthesis).

Annotation Types: Example: public @interface Example { String showSomething(); } Usage:  @Example ("Hi ! How r you") public void anymethod() --------

Annotation Types: (3) Multi-value or Full-value: These types of annotations can have multiple data members. Therefore use full value annotations to pass the values to all the data members.

Annotation Types: Example: public @interface Example { String showSomething(); int num;  String name; } Usage:  @Example (showSomething = "Hi! How r you", num=5, name="zulfiqar" ) public void anymethod // code here

Thank You