Home »
Aptitude Questions and Answers
Java Aptitude Questions and Answers
Our Java Aptitude Questions and Answers focused on all topics of Java Programming Language. Here we are providing Aptitude Solutions with Programs, Examples, Multiple Choice Questions and correct answer. You will also get explanation on correct answer.
List of Java Language Aptitude topics:
Some of the latest java programs
- Java program to replace element within the ArrayList.
In this java program, we are going to learn how to replace element of an ArrayList? Here, we have an ArrayList and replace element of it.
- Java program to check Spy number.
In this java program, we are going to check whether a given number is SPY number or not?
- Java program to check Neon number.
In this java program, we are going to check whether a given number is Neon number or not?
- Java program to find sum of array elements.
In this java program, we are going to learn how to read an array and find sum of all array elements?
- Java program to get current date and change date by adding given number of days.
In this java program, we are going to learn how to get current date and change the system’s date by adding given number of days.
- Java program to check whether a file can be read or not.
In this java program, we are going to check whether a given file can be read or not? To check this, we are using File.canRead() method.
- Java program to get minimum and maximum elements from the array.
In this Java program, we are going to read an array with N elements and find the minimum (smallest) and maximum (largest) elements from given array elements.
- Java program to print message without using semicolon.
In this java program, we are going to learn how to print any message without using semicolon?
- Java program for banking management system.
In this java program, we will learn how to create a small project like banking system? In this program, we are using some of the banking related options like deposit, withdrawal etc.
- Java program to create directory/folder in particular drive.
In this Java program, we will learn how we can create a directory or a folder? To create a directory, we use File.mkdir() method in Java.
- Java program to get the size of given file in bytes, kilobytes and megabytes.
In this Java program, we are going to learn how to get the size of a given file in bytes, kilobytes and megabytes?
- Java program to check whether a file is hidden or not.
In this java program, we are going to learn, how to check whether a file is hidden or not? Method isHidden() of File class is used to check it.
- Java program to find index of an element from an ArrayList.
In this Java program, we are going to learn how to find an index of an element from an ArrayList? To find an index of an element using ArrayList.indexOf() method.
- Java program to search an element from an ArrayList.
In this java program, we are going to learn how to search an element from an ArrayList? To find an element, we use contains() method of ArrayList class.
- Java program to create a sub list from an ArrayList.
In this Java program, we are going to learn how to create a sub list from an ArrayList? This example contains a list of some elements and creates a sub list.
- Java program to remove all elements from an ArrayList.
In this Java program, we are going to learn how to remove all elements from an ArrayList? Here, we are using ArrayList.clear() to remove all elements.
- Java program to remove elements from specific index from an ArrayList.
In this program, we a going to learn to create an ArrayList, adding elements to ArrayList and removing elements from specific index.
- Java program to add elements in ArrayList and print them in reverse order.
In this program, we are going to create an ArrayList, add elements in the ArrayList and print elements in reverse order.
- Java program to add element at specific index in ArrayList.
In this program, we are going to learn create an ArrayList, adding elements at specific index and print them on output screen.
- Java program to create an ArrayList, add elements and print.
In this java program, we are going to learn how to create an ArrayList, add elements in the ArrayList and print the elements on the output screen?
- Java program to read text from file from a specified index or skipping byte using FileInputStream.
In this program, we are going to learn how to read text from a file after skipping some bytes and print them on the output screen using FileInputStream.
- Java program to determine number of bytes written to file using DataOutputStream.
In this java program, we are going to learn how to get (determine) the number of bytes written to a file using DataOutputStream? Here, we will write text in file and print the number of written bytes.
- Java program to append text/string in a file.
In this java program, we are going to learn how to append text/string in a given file? Here, we have a file with some pre written content and we are appending text in it.
- Java program to get the last modification date and time of a file.
In this java program, we will learn how to get the file’s last modification date and time? Here, we will give a file name and program will print its last modification date and time.
- Java program to read characters from the file.
In this java program, we will learn how to read characters from a file? Here, we are using ‘FileReader’ class and its method ‘read’ to read the characters from the file.
- Java program to read Boolean value from the file.
In this java program, we are going to read Boolean value from the file using hasNextBoolean() method of Scanner class.
- Java program to rename an existing file.
In this Java program, we are going to learn how to rename an existing file? This task can we performed using renameTo() method, which is a method of File class.
- Java program to write Bytes using ByteStream.
In this program, we are going to learn to write bytes using ByteStream? To write data “byte-by-byte” in the file, we will use writeBytes() method.
- Java program to read an array using ByteStream.
In this java program, we are going to learn how to read an array using ByteStream? ByteStream reads and write byte by byte data from/in a file.
- Java program to break a string into characters.
In this article of java program, we will learn how to break a string into characters?
- Java program to count number of digits in a string.
In this article of java program, we will learn how to count the number of digits in a string?
- Java program to count number of vowels in a string.
In this article of java program, we will learn how to count the number of vowels in a string?
- Java program to count number of words in a sentence.
In this article of java program, we will learn how to count the number of words in a given sentence (combination of strings)?
- Java program to count number of uppercase and lowercase letters in a string.
In this Java program, we will learn how to count the number of uppercase and lowercase letters in a given string?
- Java program to demonstrate example of thread.
This example is based on threading in java, here we will learn how to use thread in java?
- Java program to print star pattern using class.
STAR pattern printing program in Java - This program will print the star pattern till N lines, N will be taken as input from the user.
- Java program to print pyramid of characters using class.
PYRAMID of characters printing in Java - This program will print the pyramid of characters till N lines, N will be taken as input from the user.
- Java program to swap two integer numbers using class.
Learn: How to read and swap integer numbers in Java language using class, that means swapping of numbers operations will be performed using class.
- Java program to get the IP address, Hostname based on given Hostname.
Learn: How to get the host ip address (website ip address), host name based on given host name (website name), this program will take a host name as input and print the host name, ip address.
- Java program to print the hostname and IP address of Local system.
Java program to find and print the host name, Ip address of local system. This program will print the IP address and Hostname of the system on which program will be executed.