Saturday, September 6, 2025
HomeLanguagesJavaTextStyle asNormal() method in Java with Examples

TextStyle asNormal() method in Java with Examples

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:




// Java program to demonstrate
// TextStyle.asNormal() method
  
import java.time.format.TextStyle;
  
public class GFG {
    public static void main(String[] args)
    {
  
        // get TextStyle
        TextStyle style
            = TextStyle.valueOf("SHORT_STANDALONE");
  
        // apply asNormal()
        TextStyle asNormalAttribute
            = style.asNormal();
  
        // print
        System.out.println(
            "Normal TextStyle :"
            + asNormalAttribute);
    }
}


Output:

Normal TextStyle :SHORT

Program 2:




// Java program to demonstrate
// TextStyle.asNormal() method
  
import java.time.format.TextStyle;
  
public class GFG {
    public static void main(String[] args)
    {
  
        // get TextStyle
        TextStyle style
            = TextStyle.valueOf("FULL_STANDALONE");
  
        // apply asNormal()
        TextStyle asNormalAttribute
            = style.asNormal();
  
        // print
        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()

Dominic
Dominichttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

Most Popular

Dominic
32270 POSTS0 COMMENTS
Milvus
82 POSTS0 COMMENTS
Nango Kala
6639 POSTS0 COMMENTS
Nicole Veronica
11803 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11869 POSTS0 COMMENTS
Shaida Kate Naidoo
6752 POSTS0 COMMENTS
Ted Musemwa
7029 POSTS0 COMMENTS
Thapelo Manthata
6704 POSTS0 COMMENTS
Umr Jansen
6721 POSTS0 COMMENTS