Java Interview Programs for Freshers

Subscribe to Freshers Jobs

Search 1000’s of local Job Postings ! Increase your chances to get your dream job.

Welcome to FreshersPlane, FreshersPlane Provide you latest Job Notifications , Career Opportunities, Government Jobs Information,

Don't forget to subscribe to email notifications to get all latest jobs directly to your email daily. We post more than 1000+ jobs every week.So,

Java Interview Programs for Freshers

Java Interview Programs for Freshers: As now the java programming is been trending a lot. So regarding that, the freshers should know about the basic Java programs. In the previous days in the interviews, only the questions regarding the subjects are been asked. But nowadays the companies or the organizations are been asking the freshers(nothing but the one those are attending the interview regarding Java to execute the basic Java programs. So the freshers should know the main and basic Java programs for freshers. The following are some of the Java programs that are been asked to the freshers at the interview time. Java coding questions will be based on programming, logical analysis and with problem-solving skill, which is better to get a place in first of java interview programs. As you can solve and find answers by java coding questions by yourself, and you stuck by google, and you can have many alternative ways to solve these problems and java interview questions. Knowing more than one way to solve any programming question and coding problem in Java help to have the interviewer with java interview programs for freshers.

Java Interview Programs

Java Coding Interview Questions

In this article, we have provided the java programming questions and answers for the written test. candidates those who are going to take the written test or any interview those can practice these Java interview questions. There are a huge number of Java logical programs for practice are available on the internet. Below we have listed out the programs asked in an interview for freshers and also java interview programs for experienced candidates. People who are seeking for the Java programming interview questions and answers pdf those can download it from here.

Java Programming Interview Questions

Java interview questions are available here, viewers who are going to take the java interview coding questions they can practice the Java coding questions. Here we have provided the core java interview questions, Nowadays in many interviews, Many HR’s are asking java interview coding questions to the candidates. For freshers, Recruiter’s will ask basic Java Interview questions and for experienced candidates in an interview, advanced java interview questions are asked to the candidates. So, let’s check out the Java Programming Questions here.

List Of Java Interview Programs for Freshers

Java Programming questions are very important for any Java or C++ programmer or software analyst of java interview programs. No matter on which language you have experience and that is expected that you are familiar with the fundamental of programming and also to solve problems without the help of API. Programming questions like reversing String using recursion or how to find if array contains any duplicate are also some of the examples of programming question in Java of java interview questions. Java Programming includes mainly for Java developers with C++ programmer, and one reason for this is the powerful Java API; and it has the method for every need which is rarely need to write by your own or there are many third party library from Apache, Spring, Google and also other open source.

String is the primary and also probably common thing which you come across on any programming language of latest java interview questions and also with any programming interview questions. Palindrom are those String which reverse is equal to original of best java interview questions. This could be done by using either String Buffer method or by technique which is demonstrated in the solution of java basic programming questions.

  • Write a java program to print prime numbers?
  • Write the basic Java program to find area and perimeter of circle
  • Execute or print 1 to 10 numbers without using loops
  • Execute or print numbers in pyramid shape?
  • Write a java program to add 2 Matrices
  • Write the basic Java Example Program to check even or add
  • Write the program that what happens if we place return statement in try catch blocks
  • Write a java program to convert binary to decimal
  • Write the Java Program to convert Decimal to Binary
  • Execute the program that how interfaces allow constructors?
  • Execute the program that how can we create private constructor in Java
  • Write the Java Interview Questions on main() method
  • Explain Java data types with example programs
  • Write a java program to swap two numbers without using the third variable in java
  • Write a java program to find sum of digits in java
  • Write a java program to check Even or Odd without using modulus and division
  • Write a Java program to reverse String  Without using String API
  • Write a java program to check string is palindrome or not?
  • Write a java program to reverse a number in java?
  • Write a java program for Fibonacci series with Recursive?
  • Write a java program for Fibonacci series without using Recursive?
  • Write a Java program to sort the String using String API?
  • Write a Java program to sort the String without using String API?
  • How to find the largest element in an array with index and value?
  • Write a Java program to sort integer array using bubble sort in java?
  • Write a java program to check Armstrong number or not?
  • Write a java program to multiply 2 Matrices
  • Explain return type in java
  • Execute the java program that we can call subclass methods using the super class object?
  • Execute the java program that we can override private methods?

Java Interview Programs with Output

Palindrome of String or reverse a String

import java.util.Scanner;

public class PalindromeString{
public static void main(String[] args){
Scanner in = new Scanner(System.in);
System.out.println(“Enter the string which you want to check whether that is palindrome or not: “);
String s = in.next();
String r = “”;
for(int i=s.length()-1; i>=0; i–){
r = r+s.charAt(i);
}
System.out.println(“Reverse of entered string “+s+” is “+r);
if(r.equals(s)){
System.out.println(“String “+s+” is palindrome.”);
}else{
System.out.println(“String “+s+” is not palindrome.”);
}
}
}

Output-

Enter the string which you want to check whether that is palindrome or not:
selenium
Reverse of entered string selenium is muineles
String selenium is not palindrome.

 

Check if a number is Armstrong or not

Note- A number is Armstrong if the sum of the cubes of a digit of the number is equal to the number.
ex- 407 = 4*4*4 + 0*0*0 + 7*7*7

import java.util.Scanner;

public class ArmstrongNum{
public static void main(String[] args){
Scanner in = new Scanner(System.in);
System.out.println(“Enter a number which you want to check whether that is armstrong or not: “);
int n = in.nextInt();
int a = n, r=0, s=0;

while(a!=0){
r = a%10;
a = a/10;
s = s + r*r*r;
}
if(s==n){
System.out.println(“Number “+n+” is an armstrong number.”);
}else{
System.out.println(“Number “+n+” is not an armstrong number.”);
}
}
}

output

Enter a number which you want to check whether that is Armstrong or not:
407
Number 407 is an Armstrong number.

Check a number is prime or not

Note– A number is prime if it is not divisible by any other number except itself.

import java.util.Scanner;

public class PrimeNumber{
public static void main(String[] args){
Scanner in = new Scanner(System.in);
System.out.println(“Enter a number greater than 2 which you want to check whether that number is prime or not: “);
int p = in.nextInt();
int i=2;
for(; i<10; i++){
if(p%i==0 && p!=i){
System.out.println(“Entered number “+p+” is not a prime number.”);
break;
}
}
if(i==10){
System.out.println(“Entered number “+p+” is a prime number.”);
}
}
}

Output

Enter a number greater than 2 which you want to check whether that number is prime or not:
139
Entered number 139 is a prime number.

How to get the prime numbers between a given range

package javaTutorial;

import java.util.ArrayList;
import java.util.Scanner;

public class GetPrimeNumbers{
public static void main(String[] args){
Scanner in = new Scanner(System.in);
System.out.println(“Enter a number from which you want prime number: “);
int p1 = in.nextInt();
System.out.println(“Enter one more number till which you want prime number: “);
int p2 = in.nextInt();
ArrayList<Integer> prime = new ArrayList<Integer>();
int i=2;
for(int p=p1; p<=p2; p++){
i=2;
for(; i<10; i++){
if(p%i==0 && p!=i){
break;
}
}
if(i==10){
prime.add(p);
}
}
System.out.println(“Prime numbers between “+p1+” and “+p2+” are: “);
for(int j=0; j<prime.size(); j++){
System.out.print(prime.get(j).toString()+”, “);
}
}
}
Output

Enter a number from which you want prime number:
10
Enter one more number till which you want prime number:
30
Prime numbers between 10 and 30 are:
11, 13, 17, 19, 23, 29,

Factorial of a number

import java.util.Scanner;

public class Factorial{
public static void main(String[] args){
Scanner in = new Scanner(System.in);
System.out.println(“Enter the number whose factorial you want: “);
int n = in.nextInt();
int f =1;
for(int i=n; i>0; i–){
f = f*i;
}
System.out.println(“Factorial of “+n+” is “+f);
}
}

output

Enter the number whose factorial you want:
6
Factorial of 6 is 720

Swapping Numbers without using 3rd variable

import java.util.Scanner;

public class Swapping{
public static void main(String[] args){
Scanner in = new Scanner(System.in);
System.out.println(“Enter the 1st number: “);
int x = in.nextInt();
System.out.println(“Enter the 2nd number: “);
int y = in.nextInt();



Find the Latest Jobs in our site for freshers , experience .List of walkings , fresher jobs, latest jobs,Govt Jobs, Sarkari Naukri for all engineering branches, all graduates,
Apply for all jobs mentioned in our site.

System.out.println(“Initial value of x: “+x+” and y: “+y);

x = x+y;
y = x-y;
x = x-y;

System.out.println(“After swapping value of x: “+x+” and y: “+y);
}
}

output

Enter the 1st number:
43
Enter the 2nd number:
56
Initial value of x: 43 and y: 56
After swapping value of x: 56 and y: 43

Verify a number is Even/Odd

import java.util.Scanner;

public class EvenOdd{
public static void main(String[] args){
Scanner in = new Scanner(System.in);
System.out.println(“Enter a number which you want to check whether that is even or odd”);
int n = in.nextInt();

if(n%2==0){
System.out.println(n+” is an even number.”);
}else{
System.out.println(n+” is an odd number.”);

}
}
}

 

output

Enter a number which you want to check whether that is even or odd
4
4 is an even number.

Bubble Sort

package SeleniumMakeItEasy;

import org.apache.commons.lang3.ArrayUtils;

public class BubbleSort{
public static void main(String[] args){
int[] a = {2,3,2,5,3,3,6,1,2,5};
int l = a.length;

for(int i=0;i&lt;l; i++){

for(int j=0; j&lt;l-1; j++){
if(a[j]&gt;a[j+1]){
a[j] = a[j] + a[j+1];
a[j+1] = a[j] – a[j+1];
a[j] = a[j] – a[j+1];
}else if(a[j]==a[j+1]){
a = ArrayUtils.remove(a,j);
l = a.length;
}
}
}
for(int s: a){
System.out.println(s);
}

}
}

How to Get Input from User in Java

package basic;

import java.io.*;

public class GetUserInput {

public static void main(String[] args) {

System.out.print(“Enter your name and press Enter: “);
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String name = null;
try {
name = br.readLine();
} catch (IOException e) {
System.out.println(“Error!”);
System.exit(1);
}
System.out.println(“Your name is ” + name);
}
}

Using Scanner Class [Another Way]

package basic;

import java.util.Scanner;

class GetUserInputUsingScanner
{
public static void main(String args[])
{
String s;

Scanner in = new Scanner(System.in);

System.out.println(“Enter your name and press Enter:”);
s = in.nextLine();
System.out.println(“Your Name is “+s);

}
}

Comments

comments

Latest Fresher Recruitments 2014 , 2015, 2016, 2017

Latest Govt Jobs

List of Government Jobs

AIIMS Recruitment ICAR Recruitment NIT Recruitment
ANU Recruitment ICMR Recruitment ONGC Recruitment 2017
AP Police Jobs IIPM Recruitment OPELIP Jobs 2017
AP Transco Recruitment IIt Kharagpur Ordnance Factory Recruitment
Army jobs Government Jobs in Tamil Nadu Indian Oil Recruitment
BECIL Recruitment Indian Oil Corporation Limited recruitment Railway Recruitment Board
BEL Recruitment 2017 Government Jobs in Telangana Rajya Sabha Recruitment
BHEL Recruitment Indian Post Office Recruitment RGAVP Recruitment
 Balmer Lawrie ITPO Recruitment RNTCP Recruitment 2017
bpcl recruitment VMMC & Safdarjung Hospital Recruitment satara zp recruitment 2017
BPRD Recruitment KSRTC Recruitment SCTIMST Recruitment
Cement Corporation of India (CCI) Recruitment 2017 Madras Fertilizers Limited Recruitment Singareni Collieries Company Limited (SCCL) Recruitment 2017
coal india recruitment 2017 MDL Recruitment SSB Recruitment
Cochin Shipyard Recruitment Mizoram PSC Recruitment 2017 SSC Recruitment
CPCL Recruitment Government Jobs in AP Tata Institute of Social Sciences
CRIS Recruitment MSU Baroda Tata Memorial Centre Recruitment
Delhi University Recruitment UCMS TNAU Recruitment 2017
DRDO Recruitment NABARD Recruitment TNPSC Recruitment 2017
ECHS Recruiment Navy jobs TSCAB Recruitment 2017
fci recruitment NCRTC Recruitment TSPSC Recruitment
Goa Shipyard Recruitment New India Assurance Company Ltd. Recruitment 2017 AP Govt Jobs
GPSC Recruitment NHIDCL UIIC Recruitment
HAL Recruitment NHM UKPSC Recruitment 2017
LIC Housing Recruitment NIELIT Recruitment UPSC Recruitment
HRTC Recruitment NIRT Recruitment 2017 uttarakhand gov jobs
VSSC Recruitment Telangana Govt Jobs Vizag steel plant  Recruitment

Leave a Reply

Your email address will not be published. Required fields are marked *

12 + nine =

Freshers Plane - 2017, 2016 and 2015 Freshers Job updates | Freshersplane Jobs | 2016 Freshers Job Updates | Freshersplane.com © 2017 Frontier Theme