• 16 May

    Can we start a thread twice in java

    No, Once you have started a thread, it can not be started again. If you try to start thread again , it will throw IllegalThreadStateException Lets understand with the help of example: package org.arpit.java2blog; class FirstThread extends Thread { public void run() { System.out.println("Thread is running"); } } public class StartThreadAgainMain { public static void […]

  • 15 May

    Java String compareToIgnoreCase example

    String’s compareToIgnoreCase method is similar to compareTo method. Only difference with compareTo is that it ignores cases.It also compares Strings lexigraphically. Both String get converted to unicode value and then compares. If you call str1. compareToIgnoreCase(str2) then if it returns positive number : str1 is greater than str2 0: str1 is equal to str2 negative number : str1 is […]

  • 15 May

    Ghid practic pentru casino online 777 – Cum să începi și să câștigi

    777 casino ro se remarcă pe o piață competitivă, iar acest ghid pas cu pas explică exact cum să profiți la maximum de el. Fie că ești la primul contact cu un cazino online 777 sau ai deja experiență, următoarele informații te vor ajuta să navighezi eficient, să revendici bonusuri și să gestionezi eventualele probleme. […]

  • 14 May

    Java String equalsIgnoreCase example

    String’s equalsIgnoreCase method is similar to equals method but it ignores case. So if Strings have different cases, then also it will considered as equals. For example: String str1="Java2blog.com" String str2="JAVA2BLOG.COM" str1.equalsIgnoreCase(str2) will return true. Method Signature: public boolean equalsIgnoreCase(Object anObject) String equalsIgnoreCase Example: package org.arpit.java2blog; public class StringEqualsExamplesMain { public static void main(String[] args) […]

  • 14 May

    Java String equals example

    String’s equals method compares String with specified object. It checks if both have same character sequence. It is generally used to compare two Strings. Method Signature: public boolean equals(Object anObject) String equals Example: package org.arpit.java2blog; public class StringEqualsExamplesMain { public static void main(String[] args) { String str1 = "Hello world from java2blog.com"; String str2 = […]

  • 14 May

    Java String contentEquals example

    String’s contentEquals method is used to compare String with StringBuffer. It returns boolean datatype. Method syntax: public boolean contentEquals(StringBuffer sb) String contentEquals Example: package org.arpit.java2blog; public class StringContentEqualsExample { public static void main(String[] args) { String str1 = "java2blog"; String str2="Hello world from java2blog"; String str3="JAVA2BLOG"; StringBuffer sb=new StringBuffer("java2blog"); System.out.println(str1.contentEquals(sb)); System.out.println(str2.contentEquals(sb)); System.out.println(str3.contentEquals(sb)); } } When […]

  • 13 May

    Java String endsWith example

    String’s endWith method checks if String ends with specific suffix. It returns boolean datatype. Method syntax: public boolean endsWith(String suffix) String endsWith Example: package org.arpit.java2blog; public class StringEndsWithExample { public static void main(String[] args) { String str = "java2blog"; if (str.endsWith("blog")) { System.out.println("String ends with blog"); } else { System.out.println("String does not end with blog"); […]

  • 12 May

    Java String startsWith example

    String’s startsWith method checks if String starts with specific prefix. It returns boolean datatype. Method Signature: public boolean startsWith(String prefix) String startsWith Example: package org.arpit.java2blog; public class StringStartsWithExample { public static void main(String[] args) { String str = "java2blog"; if (str.startsWith("java")) { System.out.println("String starts with java"); } else { System.out.println("String does not start with java"); […]

  • 12 May

    Java String charAt example

    String’s charAt method returns char value present at specified index. String is nothing but Sequence of char values and it starts with index 0. Method Signature: public char charAt(int index) String charAt Example: package org.arpit.java2blog; public class StringCharAtMain { /* * @Author : Arpit Mandliya */ public static void main(String args[]) { String str="java2blog"; System.out.println("char […]

Subscribe to our newletter

Get quality tutorials to your inbox. Subscribe now.