News:

GinGly.com - Used by 85,000 Members - SMS Backed up 7,35,000 - Contacts Stored  28,850 !!

Main Menu

Annotation Class Example

Started by VelMurugan, Jan 24, 2009, 10:32 PM

Previous topic - Next topic

VelMurugan

Annotation ToString() Example

Returns the String representation of this Annotation.

Annotationclass ToString() method example. This example shows you how to use ToString() method.This method Returns the String representation of this Annotation.

Here is the code:-

/*
* @Program that Returns the String representation of this Annotation.
* ToString.java
* Author:-RoseIndia Team
* Date:-16-Jun-2008
*/

import java.text.*;
public class ToString {
public static void main(String[] args) {
String s="RoseIndia";
Annotation a=new Annotation(s);
//Returns the String representation of this Annotation.
String d=a.toString();
System.out.println("The String representation of this Annotation is: "+d);
    }

}


Output of the program:-


The String representation of this Annotation is: java.text.Annotation[value=RoseIndia]

Source : codingdiary

VelMurugan

Annotation GetValue() Example

Returns the value of the attribute, which may be null.

Annotationclass GetValue() method example. This example shows you how to use GetValue() method.This method Returns the value of the attribute, which may be null.

Here is the code:-

/*
* @Program that Returns the value of the attribute, which may be null.
* GetValue.java
* Author:-RoseIndia Team
* Date:-16-Jun-2008
*/

import java.text.*;
public class GetValue {
public static void main(String[] args) {
String s="RoseIndia";
Annotation a=new Annotation(s);
//Returns the value of the attribute, which may be null.
Object s1=a.getValue();
System.out.println("The value of the attribute is: "+s1);
    }

}


Output of the program:-

The value of the attribute is: RoseIndia