TextStyle asNormal() method in Java with Examples
Last Updated :
29 Jan, 2020
The asNormal() method of TextStyle enum is used to return the normal style with the same size of this TextStyle object.
Syntax:
public TextStyle asNormal()
Parameters: This method accepts nothing.
Return value: This method returns the normal style with the same size.
Below programs illustrate the TextStyle.asNormal() method:
Program 1:
import java.time.format.TextStyle;
public class GFG {
public static void main(String[] args)
{
TextStyle style
= TextStyle.valueOf( "SHORT_STANDALONE" );
TextStyle asNormalAttribute
= style.asNormal();
System.out.println(
"Normal TextStyle :"
+ asNormalAttribute);
}
}
|
Output:
Normal TextStyle :SHORT
Program 2:
import java.time.format.TextStyle;
public class GFG {
public static void main(String[] args)
{
TextStyle style
= TextStyle.valueOf( "FULL_STANDALONE" );
TextStyle asNormalAttribute
= style.asNormal();
System.out.println( "Normal TextStyle :"
+ asNormalAttribute);
}
}
|
Output:
Normal TextStyle :FULL
References: https://docs.oracle.com/javase/10/docs/api/java/time/format/TextStyle.html#asNormal()
Share your thoughts in the comments
Please Login to comment...