Display Operating System Name in Java

karthikeya Boyini
Updated on 26-Jun-2020 15:01:44

4K+ Views

Use the System.getProperty() method in Java to get the Operating System name.It’s syntax is −String getProperty(String key)Above, the key is the name of the system property. Since, we want the OS name, therefore we will add the key as −os.nameExample Live Demopublic class Demo {     public static void main(String[] args) {        System.out.print("Operating System: ");        System.out.println(System.getProperty("os.name"));     } }OutputOperating System: Linux

History of Microprocessor

Ankith Reddy
Updated on 26-Jun-2020 15:01:17

21K+ Views

Fair child semiconductors (founded in 1957) invented the first Integrated Circuit in 1959 that marked the microprocessor history. In 1968, Gordan Moore, Robert Noyce and Andrew Grove resigned from the Fair child semiconductors and started their own company: Integrated Electronics (Intel). In 1971, the first microprocessor Intel 4004 was invented. A microprocessor is also known as a central processing unit in which numbers of peripherals’ are fabricated on a single chip. It has ALU (arithmetic and logic unit), a control unit, registers, bus systems and a clock to perform computational tasks.Generation of Microprocessor1st GenerationThis was the period during 1971 to ... Read More

Remove Substring from StringBuilder in Java

Krantik Chavan
Updated on 26-Jun-2020 15:00:46

10K+ 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

Tokenizing a String in Java

karthikeya Boyini
Updated on 26-Jun-2020 14:58:41

342 Views

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!

Reverse Characters in a StringBuffer Object in Java

Anvi Jain
Updated on 26-Jun-2020 14:57:30

216 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

Difference Between equals and equalsIgnoreCase in Java

Samual Sam
Updated on 26-Jun-2020 14:56:37

5K+ Views

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

Convert Unicode to UTF-8 in Java

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 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

Description of 8085 Pins

George John
Updated on 26-Jun-2020 14:54:29

2K+ Views

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

Check Equality Between Two Strings Ignoring Case in Java

Samual Sam
Updated on 26-Jun-2020 14:54:14

241 Views

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

Compare Strings Using CompareTo Method in Java

karthikeya Boyini
Updated on 26-Jun-2020 14:51:24

177 Views

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

Advertisements