Sunday, December 14, 2025
HomeLanguagesJavaCharArrayReader markSupported() method in Java with Examples

CharArrayReader markSupported() method in Java with Examples

The markSupported() method of CharArrayReader Class in Java is used to check whether this CharArrayReader is supports mark() operation or not. It returns a boolean which states if the reader is mark supported.

Syntax:

public boolean markSupported()

Parameters: This method does not accepts any parameters

Return Value: This method returns a boolean value which tells if this CharArrayReader supports mark() operation or not. It return true if it is markSupported. Else it returns false.

Below methods illustrates the working of markSupported() method:

Program 1:




// Java program to demonstrate
// CharArrayReader markSupported() method
  
import java.io.*;
import java.util.*;
  
class GFG {
    public static void main(String[] args)
    {
  
        try {
  
            char[] str = { 'G', 'e', 'e', 'k', 's',
                           'F', 'o', 'r',
                           'G', 'e', 'e', 'k', 's' };
  
            // Create a CharArrayReader instance
            CharArrayReader reader
                = new CharArrayReader(str);
  
            // Check if the CharArrayReader is
            // markSupported using markSupported()
            System.out.println("Is CharArrayReader markSupported: "
                               + reader.markSupported());
  
            reader.close();
        }
        catch (Exception e) {
            System.out.println(e);
        }
    }
}


Output:

Is CharArrayReader markSupported: true

Program 2:




// Java program to demonstrate
// CharArrayReader markSupported() method
  
import java.io.*;
import java.util.*;
  
class GFG {
    public static void main(String[] args)
    {
  
        try {
            char[] str = { 'G', 'E', 'E', 'K', 'S' };
  
            // Create a CharArrayReader instance
            CharArrayReader reader
                = new CharArrayReader(str);
  
            // Check if the CharArrayReader is
            // markSupported using markSupported()
            System.out.println("Is CharArrayReader markSupported: "
                               + reader.markSupported());
  
            reader.close();
        }
        catch (Exception e) {
            System.out.println(e);
        }
    }
}


Output:

Is CharArrayReader markSupported: true

Reference: https://docs.oracle.com/javase/9/docs/api/java/io/CharArrayReader.html#markSupported–

RELATED ARTICLES

Most Popular

Dominic
32448 POSTS0 COMMENTS
Milvus
105 POSTS0 COMMENTS
Nango Kala
6817 POSTS0 COMMENTS
Nicole Veronica
11954 POSTS0 COMMENTS
Nokonwaba Nkukhwana
12031 POSTS0 COMMENTS
Shaida Kate Naidoo
6953 POSTS0 COMMENTS
Ted Musemwa
7202 POSTS0 COMMENTS
Thapelo Manthata
6899 POSTS0 COMMENTS
Umr Jansen
6883 POSTS0 COMMENTS