TextStyle isStandalone() method in Java with Examples
Last Updated :
29 Jan, 2020
The isStandalone() method of TextStyle enum is used to return true if the TextStyle is a stand-alone style.
Syntax:
public TextStyle isStandalone()
Parameters: This method accepts nothing.
Return value: This method returns true if the style is a stand-alone style.
Below programs illustrate the TextStyle.isStandalone() method:
Program 1:
import java.time.format.TextStyle;
public class GFG {
public static void main(String[] args)
{
TextStyle style
= TextStyle.valueOf(
"SHORT_STANDALONE" );
boolean isStandaloneAttribute
= style.isStandalone();
System.out.println(
"TextStyle is Standalone:"
+ isStandaloneAttribute);
}
}
|
Output:
TextStyle is Standalone:true
Program 2:
import java.time.format.TextStyle;
public class GFG {
public static void main(String[] args)
{
TextStyle style
= TextStyle.valueOf( "FULL" );
boolean isStandaloneAttribute
= style.isStandalone();
System.out.println(
"TextStyle is Standalone:"
+ isStandaloneAttribute);
}
}
|
Output:
TextStyle is Standalone:false
References: https://docs.oracle.com/javase/10/docs/api/java/time/format/TextStyle.html#isStandalone()
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...