Core java
09 OctoberJava program to calculate grade of students
In this post, we will see how to calculate grade of students in java. Student’s grade is decided by average of marks.It is good program to practice execution of if statements in java. Here is simple program to calculate grade of students package org.arpit.java2blog; import java.util.Scanner; public class GradeCalculation { public static void main(String args[]){ […]
09 OctoberFind Vowels in a String
In this post, we will see how to find and count vowels in a string. [toc] 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. package org.arpit.java2blog; public class HelloWorld { public static void main(String[] args) { System.out.println("Hello world from […]
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. List<List> arraylist2D = new ArrayList<List>(); Let’s create a program to implement 2d Arraylist java. package org.arpit.java2blog; import java.util.ArrayList; import java.util.List; public class Java2DArrayListMain { public static void main(String[] […]
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. [toc] 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+ package org.arpit.java2blog; public class JavaisNumericMain { […]
06 OctoberConvert char to lowercase java
You can use Character class’s toLowerCase method to convert char to lowercase in java. Method signature public static char toLowerCase(char ch) Parameters ch is primitive character type. Return type return type is char. If char is already lowercase then it will return same. package org.arpit.java2blog; public class JavaToLowercaseMain { public static void main(String[] args) { […]
06 OctoberConvert char to uppercase java
You can use Charater class’s touppercase method to convert char to uppercase in java. Method signature public static char touppercase(char ch) Parameters ch is primitive character type. Return type return type is char. If char is already uppercase then it will return same. package org.arpit.java2blog; public class JavaToUpperCaseMain { public static void main(String[] args) { […]
06 OctoberJava isLetter method
Character class’s isletter method can be used to check if character is letter or not. Method signature public static boolean isLetter(char ch): Parameters ch is primitive character type. Return type boolean is primitive character type. package org.arpit.java2blog; public class JavaIsLetterMain { public static void main(String[] args) { System.out.println(Character.isLetter('a')); System.out.println(Character.isLetter('Y')); System.out.println(Character.isLetter('5')); System.out.println(Character.isLetter('&')); } } When you […]