We have the following string −String str = "This is demo text, and demo line!";To tokenize the string, let us split them after every period (.) and comma (,)String str = "This is demo text, and demo line!";The following is the complete example.Example Live Demopublic class Demo { public static void main(String[] args) { String str = "This is demo text, and demo line!"; String[] res = str.split("[, .]", 0); for(String myStr: res) { System.out.println(myStr); } } }OutputThis is demo text and demo line!
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
Use equals() in Java to check for equality between two strings.Use equalsIgnoreCase() in Java to check for equality between two strings ignoring the case.Let’s say the following are our two strings −String one = "qwerty"; String two = "Qwerty";Both are equal, but the case is different. Since the method ignores case, both of these strings would be considered equal using equalsIgnoreCase() method.Here, we are checking the same −if(one.equalsIgnoreCase(two)) { System.out.println("String one is equal to two (ignoring the case) i.e. one==two"); }else{ System.out.println("String one is not equal to String two (ignoring the case) i.e. one!=two"); }However, under ... Read More
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
The 8085 is an 8-bit microprocessor designed by Intel in 1977 using NMOS technology that can address 64K Byte of memory. It has 40 pins DIP (Dual Inline Package) IC.In bellow fig, the pin number, and its associated functions are indicated for each of the 40 pins:Data pinsAD7-0 are known as data pins and carries lower order address bits of memory and I/O Address. These pins are bi-directional pins. The same lines are used for both receiving information and sending out information because, at any instant of time, the processor is either receiving or sending out information, but not both.Address pinsA15-8 ... Read More
Use equalsIgnoreCase() in Java to check for equality between two strings ignoring the case.Let’s say the following are our two strings.String one = "rocky"; String two = "Rocky";Both are equal, but the case is different. Since the method ignore case, both of these strings would be considered equal.Here, we are checking the same.if(one.equalsIgnoreCase(two)) { System.out.println("String one is equal to two (ignoring the case) i.e. one==two"); }else{ System.out.println("String one is not equal to String two (ignoring the case) i.e. one!=two"); }The following is the complete example.Example Live Demopublic class Demo { public static void main(String[] args) { String one = "rocky"; ... Read More
The compareTo(obj) method compares this String to another Object.The value 0 is returned if the argument is a string lexicographically equal to this string; a value less than 0 if the argument is a string lexicographically greater than this string; and a value greater than 0 if the argument is a string lexicographically less than this string.We have the following two strings −String str1 = "tom"; String str2 = "tim";Let us check them for all the return values.if(str1.compareTo(str2) > 0) { System.out.println("First string is greater!"); } if(str1.compareTo(str2) == 0) { System.out.println("First string is equal to Second string!"); } if(str1.compareTo(str2) 0) { System.out.println("First string ... Read More
VCC (Voltage Common Collector) is the higher voltage with respect to GND (ground). VCC is the power input of a device. It may be positive or negative with respect to GND. When the only positive power supply is used then VSS (Voltage Source Supply) means ground or zero. The Intel 8085 Microprocessor needs a power supply of +5 V DC for its working. Pin 40 of Intel 8085 is the Vcc pin. It should be connected to +5 V DC power supply. Pin 20 of 8085 is the Vss pin.
Use the charAt() method in Java to get a character located at a specified index.Let’s say the following is our string.String str = "Laptop...";Finding character at 3rd position.str.charAt(2);The following is the final example.Example Live Demopublic class Demo { public static void main(String[] args) { String str = "Laptop..."; System.out.println("String: "+str); System.out.println("Character at position 3 = " +str.charAt(2)); } }OutputString: Laptop... Character at position 3 = p
A Pascal’s triangle contains numbers in a triangular form where the edges of the triangle are the number 1 and a number inside the triangle is the sum of the 2 numbers directly above it.A program that demonstrates the creation of the Pascal’s triangle is given as follows.Example Live Demousing System; namespace PascalTriangleDemo { class Example { public static void Main() { int rows = 5, val = 1, blank, i, j; Console.WriteLine("Pascal's triangle"); for(i = 0; i