Core java
09 OctoberFind Vowels in a String
In this post, we will see how to find and count vowels in a string. Find Vowels in a String If any character in String satisfy below condition then it is vowel and we will add it to Hashset. character==’a’ || character==’A’ || character==’e’ || character==’E’ || character==’i’ || character==’I’ || character==’o’ || character==’O’ || […]
09 October[Fixed] Reached end of file while parsing
In this post, we will see how to solve reached end of file while parsing in java. We generally get this error when we forgot to end code of block(class/method) with }. Let’s understand this with the help of example. [crayon-6a297824e574c255517620/] When you compile above java file, you will get below error. java:8: reached end […]
06 OctoberJava remove last character from string
Learn about how to remove last character from String in java using different ways.
06 October2d Arraylist java example
In this post, we will see how to create 2d Arraylist in java. Best way to create 2d Arraylist is to create list of list in java. [crayon-6a297824e5ab3003420584/] Let’s create a program to implement 2d Arraylist java. [crayon-6a297824e5abc843248696/] Output: 2nd element in list3 : List3_Str2 3nd element in list1 : List1_Str3 1st element in list2 […]
06 OctoberJava isNumeric method
In this post, we will see how to implement isNumeric method in java. There are many way to check if String is numeric or not. Let’s see one by one. Using regular expressions You can use below regular expression to check if string is numeric or not. [-+]?\\d*\\.?\\d+ [crayon-6a297824e5c3d703316121/] Output: 223 is numeric : true […]
06 OctoberConvert char to lowercase java
You can use Character class’s toLowerCase method to convert char to lowercase in java. Method signature [crayon-6a297824e600a419814447/] Parameters ch is primitive character type. Return type return type is char. If char is already lowercase then it will return same. [crayon-6a297824e6011019854466/] When you run above program, you will get below output: a y b z That’s […]
06 OctoberConvert char to uppercase java
You can use Charater class’s touppercase method to convert char to uppercase in java. Method signature [crayon-6a297824e6164517394181/] Parameters ch is primitive character type. Return type return type is char. If char is already uppercase then it will return same. [crayon-6a297824e616a070718559/] When you run above program, you will get below output: A Y F U That’s […]
06 OctoberJava isLetter method
Character class’s isletter method can be used to check if character is letter or not. Method signature [crayon-6a297824e6286590947343/] Parameters ch is primitive character type. Return type boolean is primitive character type. [crayon-6a297824e628b404201262/] When you run above program, you will get below output: true true false false That’s all about java Character’s isletter method.
06 OctoberFix cannot make static reference to non-static method
In this post, we will see how to solve cannot make static reference to non-static method. Let’s understand this error with the help of example. [crayon-6a297824e6d3b224896478/] Above program won’t compile and you will get below compilation error. It says cannot make static reference to non-static method sayHello from the type JavaHelloWorld Why are you getting […]