If you are new to Java this page will help you. This page contains simple programming examples on various topics in Java like variables, loops,classes,exceptions, etc. Feel free to run this code and try it out yourself!
Java Strings
- How to check if an input character is a vowel
- How to reverse a sentence via Java
- How to replace a String with another String in Java
- How to check if a String is a substring of another String
- How to check if a String has digits in Java
- How to split a String via Java
- How to find the count of each character in a String in Java
- How to convert a String to lowercase in Java
- How to remove a character from a String via Java
- How to convert a String to uppercase
- How to convert a String to a Date
- How to reverse a String in Java
- How to find the number of words in a Sentence
- How to check if a String has only alphabets
- How to replace a character in a String with another character
Java Collection Framework
- Difference between Comparator and Comparable
- How to sort a List in Descending order
- Java TreeSet and HashSet similarities and differences
- How to reverse a List in Java
- How to convert a Java list to an array
- How to find if two lists are exactly the same
- How to create a list with data without using list.add multiple times
- How to sort a List via Java
- How to shuffle the elements in a List via Java
- How to find the maximum and minimum number in a List
- How to convert a List to a Set
- How to remove duplicate elements from a List
- How to convert an Array to a List
Miscellaneous Java Examples
- How to count the number of vowels and consonants in a String
- How to find the number of digits in a number
- How to find the largest number in an array
- How to check if a number is even or odd
- How to calculate the sum of the numbers in an array
- How to check if a number is a prime number
- Java loops Examples
- How to add two numbers in Java
- How to find the factorial of a number
- How to find the largest number in an array
Java IO
- How to obtain a list of files in a folder
- How to read a CSV file via Java
- How to find the free space in a drive via Java
- How to find the total space in a drive in Java
- How to make a file read-only in Java
- How to create a Directory in Java
- How to create a new file using Java
- How to rename a file
- How to delete a folder in Java
- How to Delete a file
- How to check if a file exists at the specified path
- How to read input from the user in Java
- How to read a file in Java
Java Date Handling
- How to add Days to a Date in Java with code samples
- How to check if a Date is before or after another Date
- How to find the number of years between two Dates
- How to find the day of the week represented by a particular date
- How to convert a String to a Date
- How to print the current date and time
- How to find the number of days between two Dates