Core java
28 SeptemberJava String Replace
Java String replace method replaces all occurrences of old char to new char or old CharSequence to new CharSequence and return new String. If there is nothing to replace in the String, it will return same String. Let’s say you need to convert "Java2blog" to "JavaTwoblog", you can simply use below syntax. [crayon-6a2990832242a970298897/] Syntax There […]
25 SeptemberList vs ArrayList in java
In this post, we will see the difference between List and ArrayList in Java. List is an interface where ArrayList is concrete implementation, so List is more generic than ArrayList. You can instance an ArrayList in below two ways.You might have seen this code before. [crayon-6a29908325dd2273815391/] If you use 1st way, you can change the […]
24 SeptemberHow to convert List to Set in java
In this post, we will see how to convert List to Set in java.We will convert ArrayList to HashSet. As HashSet does not allow duplicates, when you convert ArrayList to HashSet, all the duplicates will be discarded. You can simply use the constructor of HashSet to convert ArrayList to HashSet. [crayon-6a29908327913419819563/] Here is simple example: […]
24 SeptemberBigDecimal compareTo
In this post,we will see about Bigdecimal‘s compareTo method.This method is used to compare two BigDecimals. Syntax [crayon-6a2990832c1ae885220178/] Return type CompareTo method returns -1,0,1 -1 : First BigDeicmal is less than second BigDecimal 0 : First BigDecimal is equal to second BigDecimal 1 : First BigDecimal is greater than second BigDecimal BigDecimal CompareTo example Let’s […]
24 SeptemberJava Runnable example
In this post, we will see Java Runnable example. As you might know, there are two ways of creating threads in java. Extending thread class Implementing Runnable interface. As you can extend only one class in java, it is not possible to extend any other class if a class extends thread class.You can also implement […]
23 SeptemberHow to invoke method using reflection in java
In this post, we will see how to invoke the method using reflection in java. Let’s understand this with the help of the example. Create a class named Employee.java. We will invoke this class’s method using reflection. [crayon-6a2990832d69f678112763/] Create a main method named EmployeeReflectionMain.java. [crayon-6a2990832d6a6581174355/] When you run above program, you will get below output: […]
23 SeptemberJava Reflection tutorial
Introduction Reflection, as we know from the common term, is an image of yourself or something else you see in a mirror or a mirrored surface. Java, being an object-oriented language draws heavily from real-life examples and so is the Reflection API of Java inspired from real life. In Java, the process of analyzing, viewing […]
22 SeptemberJava program to Remove element from array
In this post, we will see how to remove an element from array in java. Unlike Arraylist,Java Arrays class does not provide any direct method to add or delete element. As Array is fixed size in nature, you can not shrink or grow it dynamically. You need to create new array and copy all elements […]
19 SeptemberVodnik za začetek igranja – registracija, bonus in nasveti
Začetek z Bc online game je preprost, ko poznate korake – ta vodnik vas vodi skozi vsakega. Priprave Veljaven e-poštni naslov in mobilna številka (za potrditev). Osebni dokument (osebna izkaznica ali potni list) za preverjanje starosti. Stabilna internetna povezava – priporočljivo vsaj 10 Mb/s za nemoteno igranje. Podprta naprava: sodoben brskalnik (Chrome, Firefox, Safari) na […]