Nancy Den has Published 290 Articles

Call append() method to construct a StringBuffer object in Java

Nancy Den

Nancy Den

Updated on 26-Jun-2020 15:29:55

241 Views

The StringBuffer append() method appends the String representation of the particular argument to the sequence. It is a method of the java.lang.StringBuffer class. This method returns a reference to the object.The method changes the value of the object called in the method. Each primitive data type will have a separate ... Read More

Get the capacity of the StringBuffer Object in Java

Nancy Den

Nancy Den

Updated on 26-Jun-2020 15:13:15

184 Views

The capacity() method is a method of the StringBuffer class . It returns the quantity of storage present for recently inserted characters, after which an allocation occurs.Declaration-The java.lang.StringBuffer.capacity() method is declared as follows−public int capacity()Let us see an example program showing how to get the capacity of the StringBuffer Object.Example Live ... Read More

Get the arc sine of an angle in Java

Nancy Den

Nancy Den

Updated on 26-Jun-2020 15:05:58

228 Views

To get the arc sine of a given value in Java, we use the java.lang.Math.asin() method. The asin() method accepts a double value whose angle needs to be computed. The range of the angle returned lies in the range -pi/2 to pi/2. If the argument is NaN, then the result ... Read More

Convert Unicode to UTF-8 in Java

Nancy Den

Nancy Den

Updated on 26-Jun-2020 14:56:04

13K+ 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 ... Read More

Check if the String has only unicode digits or space in Java

Nancy Den

Nancy Den

Updated on 26-Jun-2020 13:42:19

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 ... Read More

Place Stack Trace into a String in Java

Nancy Den

Nancy Den

Updated on 26-Jun-2020 13:28:16

422 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 ... Read More

Get ceiling value of a number using Math.ceil in Java

Nancy Den

Nancy Den

Updated on 26-Jun-2020 13:25:18

2K+ Views

In order to get the ceiling value of a number in Java, we use the java.lang.Math.ceil() method. The Math.ceil() method returns the smallest (closest to negative infinity) double value which is greater than or equal to the parameter and has a value which is equal to a mathematical integer on ... Read More

Explain the ODBC architecture?

Nancy Den

Nancy Den

Updated on 26-Jun-2020 10:39:16

1K+ Views

ODBC architecture consists of the following components.Application: An application which communicates with the databases using ODBC functions is an ODBC application.ODBC driver manager: The ODBC diver manager manages the underlying drivers in an application. Whenever an application calls a function of ODBC API to communicate with a database, the driver ... Read More

Assertions in Java

Nancy Den

Nancy Den

Updated on 26-Jun-2020 06:51:31

6K+ Views

An assertion is a statement in Java which ensures the correctness of any assumptions which have been done in the program. When an assertion is executed, it is assumed to be true. If the assertion is false, the JVM will throw an Assertion error. It finds it application primarily in ... Read More

How to catch an assertion error in Java

Nancy Den

Nancy Den

Updated on 25-Jun-2020 15:15:15

8K+ Views

In order to catch the assertion error, we need to declare the assertion statement in the try block with the second expression being the message to be displayed and catch the assertion error in the catch block.Let us see a program on how to handle Assertion Error in Java −Examplepublic ... Read More

Advertisements