Skip to content

Automation Testing

Java, Selenium etc..

  • Java
  • Selenium
  • Interview Question
  • Core Java Coding
  • Rest APIS
  • Manual Testing
  • SQL Queries
  • Postman
  • Toggle search form

Category: Core Java Coding Questions

Core Java Coding Questions

Can you write java program for prime number 1to 50 and skip printing 30 and 40 numbers

Posted on May 28, 2023May 28, 2023 By admin

package BasicCoreJavaExamples;import java.util.Scanner;public class PrintPrimeNumbers { public static void main(String[] args) { Scanner src = new Scanner(System.in); System.out.println(“Enter prime number till to :”); int lastNum = src.nextInt(); int count = 0; if (lastNum == 0 || lastNum == 1) { System.out.println(“The given numbers are nor prime number.”); } for (int i = 2; i <=…

Read More “Can you write java program for prime number 1to 50 and skip printing 30 and 40 numbers” »

Core Java Coding Questions, Selenium

Create a Java program to store the Name and Salary of employees

Posted on May 12, 2023May 25, 2023 By admin

//Create a Java program to store the Name and Salary of employees //Name = [‘Ram’,’Rahim’,’Sid’,’Tom’] //Salary = [30000,20000,35000,23000] // //1. Add a new employee to the dictionary with name as ‘Shankar’ and salary as 15000 //2. Update the salary of tom to 25000 //3. List the names of employees who earn more than 20000 package…

Read More “Create a Java program to store the Name and Salary of employees” »

Core Java Coding Questions

String Char Counts Using Collections

Posted on May 10, 2023May 10, 2023 By admin

String Char Counts Using Collections: package InterViewQuestions;import java.util.HashMap;import java.util.Map;public class StringCharCountsUsingCollections { //string = hemchandrraBhatt //print number chars repeated public static void main(String[] args) { String str = “hemchandrabhatt”; HashMap<Character, Integer> mapCharCount = new HashMap<>(); char[] charArr = str.toCharArray(); for (char c : charArr) { if (mapCharCount.containsKey(c)) { mapCharCount.put(c, mapCharCount.get(c) + 1); } else {…

Read More “String Char Counts Using Collections” »

Core Java Coding Questions

Remove Duplicates From Int Array

Posted on May 8, 2023May 8, 2023 By admin

There are many ways to remove duplicate items A) Using for Loop package InterViewQuestions; public class RemoveDuplicatesFromArray { public static void main(String[] args) { Integer[] integer_Array = {50, 50, 100, 100, 99, 99, 9, 9, 100, 100}; int [] temp = new int[integer_Array.length]; for(int i =0; i< integer_Array.length; i++){ for(int j = i+1; j <…

Read More “Remove Duplicates From Int Array” »

Core Java Coding Questions, Java Basic Interview Questions(company wise)

Recent Posts

  • Can you write java program for prime number 1to 50 and skip printing 30 and 40 numbers
  • Java 8 features
  • Imp Links
  • Create a Java program to store the Name and Salary of employees
  • String Char Counts Using Collections

Recent Comments

No comments to show.

Copyright © 2022 okhalaTech