- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 4335 Articles for Java 8
![Nancy Den](https://www.tutorialspoint.com/assets/profiles/13557/profile/60_88439-1512714529.jpg)
301 Views
In order to place stack trace into a String in Java, we use the java.io.StringWriter and java.io.PrintWriter classes. In a catch block, after catching the exception, we print the stack trace by printStackTrace() method and write it into the writer and then use the ToString() method to convert it into a String.Let us see a program to place the stack trace into a String in Java.Example Live Demoimport java.io.PrintWriter; import java.io.StringWriter; public class Example { public static void main(String[] args) { try{ int ans = 10/0; }catch (ArithmeticException ex) { ... Read More
![Krantik Chavan](https://www.tutorialspoint.com/assets/profiles/13545/profile/60_126883-1512724834.jpg)
5K+ Views
In order to print the stack trace in Java, we use the java.lang.Throwable.printStackTrace() method. The printStackTrace() method prints the throwable and its backtrace in the standard error stream.Declaration - The java.lang.Throwable.printStackTrace() method is declared as follows −public void printStackTrace()Let us see a program to print the stack trace in Java.Example Live Demopublic class Example { public static void main(String args[]) throws Throwable { try { int n = 3; System.out.println(n/0); } catch (ArithmeticException e) { System.out.println("Printing stack trace..."); ... Read More
![Smita Kapse](https://www.tutorialspoint.com/assets/profiles/13597/profile/60_103706-1512718957.jpg)
372 Views
In order to check if a String has only unicode digits in Java, we use the isDigit() method and charAt() method with decision making statements.The isDigit(int codePoint) method determines whether the specific character (Unicode codePoint) is a digit. It returns a boolean value, either true or false.Declaration − The java.lang.Character.isDigit() method is declared as follows −public static boolean isDigit(int codePoint)where the parameter codePoint represents the character to be checked.The charAt() method returns a character value at a given index. It belongs to the String class in Java. The index must be between 0 to length()-1.Declaration − The java.lang.String.charAt() method is ... Read More
![Nancy Den](https://www.tutorialspoint.com/assets/profiles/13557/profile/60_88439-1512714529.jpg)
4K+ Views
In order to check if a String has only unicode digits or space in Java, we use the isDigit() method and the charAt() method with decision making statements.The isDigit(int codePoint) method determines whether the specific character (Unicode codePoint) is a digit. It returns a boolean value, either true or false.Declaration - The java.lang.Character.isDigit() method is declared as follows −public static boolean isDigit(int codePoint)The charAt() method returns a character value at a given index. It belongs to the String class in Java. The index must be between 0 to length()-1.Declaration − The java.lang.String.charAt() method is declared as follows −public char charAt(int ... Read More
![Anvi Jain](https://www.tutorialspoint.com/assets/profiles/13591/profile/60_98631-1512716973.jpg)
22K+ Views
Before converting a String to UTF-8-bytes, let us have a look at UTF-8.UTF-8 is a variable width character encoding. UTF-8 has ability to be as condense as ASCII but can also contain any unicode characters with some increase in the size of the file. UTF stands for Unicode Transformation Format. The '8' signifies that it allocates 8-bit blocks to denote a character. The number of blocks needed to represent a character varies from 1 to 4.In order to convert a String into UTF-8, we use the getBytes() method in Java. The getBytes() method encodes a String into a sequence of ... Read More
![Krantik Chavan](https://www.tutorialspoint.com/assets/profiles/13545/profile/60_126883-1512724834.jpg)
5K+ Views
Before moving onto their conversions, let us learn about Unicode and UTF-8.Unicode is an international standard of character encoding which has the capability of representing a majority of written languages all over the globe. Unicode uses hexadecimal to represent a character. Unicode is a 16-bit character encoding system. The lowest value is \u0000 and the highest value is \uFFFF.UTF-8 is a variable width character encoding. UTF-8 has the ability to be as condense as ASCII but can also contain any unicode characters with some increase in the size of the file. UTF stands for Unicode Transformation Format. The '8' signifies ... Read More
![Nancy Den](https://www.tutorialspoint.com/assets/profiles/13557/profile/60_88439-1512714529.jpg)
11K+ Views
Before moving onto their conversions, let us learn about Unicode and UTF-8.Unicode is an international standard of character encoding which has the capability of representing a majority of written languages all over the globe. Unicode uses hexadecimal to represent a character. Unicode is a 16-bit character encoding system. The lowest value is \u0000 and the highest value is \uFFFF.UTF-8 is a variable width character encoding. UTF-8 has the ability to be as condensed as ASCII but can also contain any Unicode characters with some increase in the size of the file. UTF stands for Unicode Transformation Format. The '8' signifies ... Read More
![Anvi Jain](https://www.tutorialspoint.com/assets/profiles/13591/profile/60_98631-1512716973.jpg)
160 Views
In order to reverse the sequence of characters in a StringBuffer Object, we use the reverse() method. The reverse() method replaces the character sequence with the reverse of its own.Declaration − The java.lang.StringBuffer.reverse method is declared as follows−public StringBuffer reverse()Let us see a program to reverse the sequence of characters in a StringBuffer Object using the reverse() method.Example Live Demopublic class Example { public static void main(String[] args) { StringBuffer sb = new StringBuffer("Hello World"); System.out.println("Original StringBuffer Object: " + sb); sb.reverse(); System.out.println("New StringBuffer Object: " +sb); ... Read More
![Krantik Chavan](https://www.tutorialspoint.com/assets/profiles/13545/profile/60_126883-1512724834.jpg)
9K+ Views
In order to remove a substring from a Java StringBuilder Object, we use the delete() method. The delete() method removes characters in a range from the sequence. The delete() method has two parameters, start, and end. Characters are removed from start to end-1 index.Declaration − The java.lang.StringBuilder.delete() method is declared as follows −public StringBuilder delete(int start, int end)Let us see an example which removes a substring from a StringBuilder.Example Live Demopublic class Example { public static void main(String[] args) { StringBuilder sb = new StringBuilder("Welcome to Java Programming"); System.out.println("Original StringBuilder Object: " + sb.toString()); ... Read More
![Anvi Jain](https://www.tutorialspoint.com/assets/profiles/13591/profile/60_98631-1512716973.jpg)
1K+ Views
In order to remove characters in a specific range from a Java StringBuffer Object, we use the delete() method. The delete() method removes characters in a range from the sequence. The delete() method has two parameters , start and end. Characters are removed from start to end-1 index.Declaration − The java.lang.StringBuffer.delete() method is declared as follows −Let us see a program to delete characters in a specific range from a Java StringBuffer Object.Example Live Demopublic class Example { public static void main(String[] args) { StringBuffer sb = new StringBuffer("Hello World"); System.out.println("Original StringBuffer Object: " ... Read More