Core java
08 MayGuía práctica de apuestas Sportium: matemáticas y trucos de operador
Esta no es una reseña genérica de casino — este es un manual práctico de operador para los jugadores de Sportium apuestas. Aquí encontrarás todo lo necesario para gestionar tu cuenta, calcular bonos, resolver problemas y exprimir al máximo tu experiencia. Getting Ready Verifica que tienes conexión a internet estable y un dispositivo compatible (PC, […]
07 MayWhy String is immutable in java
String class is immutable in java. If you take dictionary meaning of immutable, it means unable to be changed or unchanging over time, so String is unchangeable or unmodifiable in java. Let’s understand with example. String str1="Hello"; str1.concat("java2blog"); System.out.println(str1); // Output will be Hello As you can see, value of str1 did not change. It […]
07 MayJava String lastIndexOf example
String’s lastIndexOf method is used to find out last index of any character or sub string. lastIndexOf method can take char or string as argument and also you can provide fromIndex also. Methods: public int lastIndexOf(int ch) returns index of last occurrence of character within String public int lastIndexOf(int ch,int fromIndex) returns index of last occurrence […]
07 MayJava String indexOf example
String’s indexOf method is used to find out index of any character or sub string. indexOf method can take char or string as argument and also you can provide fromIndex(Index after which you want to use indexOf method) also. Methods: public int indexOf(int ch) returns index of first occurrence of character within String public int […]
06 MayJava String substring example
String’s substring method is used to fetch part of a String.It returns a new String which is substring of given String. substring is nothing but subset of given String. There are two overloaded methods for substring. Method Signature: public String substring(int startIndex) It returns a new String which is substring of given String from specified […]
06 MayJava String contains example
String’s contains method checks if sequence of characters can be found in String. It returns true if character sequence is present in String else return false. Method Signature: public boolean contains(CharSequence s) String contains Example: package org.arpit.java2blog; public class StringContainsMethodExample { public static void main(String[] args) { String str = "Hello world from java2blog.com"; if […]
06 MayJava String concatenate example
String concatenate is a way to join multiple Strings to create large String. There are many places where we use to do String concatenate. For example: When you override toString() method of object, you concatenate multiple attributes to create a big String that represent that object. 3 ways to concatenate String Using + operator Using String’s […]
06 MayHow to split a String in java
In this post, we will see how to split a String by delimiter in java. Sometimes, we need to split a String by delimiter for example: while reading a csv file, we need to split string by comma(,). We will use String class’s split method to split a String. This split(regex) takes a regex as […]
04 MayHow to convert Char Array to String in java
There are multiple ways to convert Char Array to String in java. Some of them are: Using String class’s constructor (By passing Char array to contructor) Using String class’s valueOf method Using iterating char array Example: package org.arpit.java2blog; public class CharArrToStringMain { /* * @ Author : Arpit Mandliya */ public static void main(String args[]) […]