HomeLanguagesJavaTextStyle asStandalone() method in Java with Examples

TextStyle asStandalone() method in Java with Examples

The asStandalone() method of TextStyle enum is used to return the stand-alone style with the same size of this TextStyle object.

Syntax:

public TextStyle asStandalone()

Parameters: This method accepts nothing.

Return value: This method returns the stand-alone style with the same size.

Below programs illustrate the TextStyle.asStandalone() method:

Program 1: 

Java




// Java program to demonstrate// TextStyle.asStandalone() methodimport java.time.format.TextStyle;public class GFG {    public static void main(String[] args)    {        // get TextStyle        TextStyle style            = TextStyle.valueOf("SHORT");        // apply asStandalone()        TextStyle asStandaloneAttribute            = style.asStandalone();        // print        System.out.println(            "Standalone TextStyle :"            + asStandaloneAttribute);    }}


Output:

Standalone TextStyle :SHORT_STANDALONE

Program 2: 

Java




// Java program to demonstrate// TextStyle.asStandalone() methodimport java.time.format.TextStyle;public class GFG {    public static void main(String[] args)    {        // get TextStyle        TextStyle style            = TextStyle.valueOf("FULL");        // apply asStandalone()        TextStyle asStandaloneAttribute            = style.asStandalone();        // print        System.out.println("Standalone TextStyle :"                           + asStandaloneAttribute);    }}


Output:

Standalone TextStyle :FULL_STANDALONE

References: https://docs.oracle.com/javase/10/docs/api/java/time/format/TextStyle.html#asStandalone()

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

3 COMMENTS

Most Popular

Dominic
32712 POSTS0 COMMENTS
Milvus
131 POSTS0 COMMENTS
Nango Kala
7088 POSTS0 COMMENTS
Nicole Veronica
12228 POSTS0 COMMENTS
Nokonwaba Nkukhwana
12310 POSTS0 COMMENTS
Shaida Kate Naidoo
7203 POSTS0 COMMENTS
Ted Musemwa
7470 POSTS0 COMMENTS
Thapelo Manthata
7189 POSTS0 COMMENTS
Umr Jansen
7171 POSTS0 COMMENTS