Add office photos
Employer?
Claim Account for FREE

Wittybrains Software Technologies

4.0
based on 31 Reviews
Filter interviews by

SasteGhar.com Interview Questions and Answers

Updated 5 Feb 2024
Popular Designations

Q1. Wap where n=2, power=3, output=8 using recursion

Ans.

A Java program to calculate the power of a number using recursion.

  • Create a recursive function that takes two parameters: the number and the power.

  • If the power is 0, return 1.

  • If the power is 1, return the number.

  • Otherwise, recursively call the function with the number multiplied by itself and the power decreased by 1.

  • Return the result.

View 1 answer

Q2. Wap to print prime number between 1-100 alternately?

Ans.

Print prime numbers between 1-100 alternately using Java.

  • Create a function to check if a number is prime or not.

  • Use a loop to iterate through numbers 1-100.

  • Alternate between printing prime and non-prime numbers.

  • Use a boolean variable to keep track of whether the last printed number was prime or not.

Add your answer

Q3. Wap to print prime number between 1-100?

Ans.

A program to print prime numbers between 1-100.

  • Iterate from 1 to 100

  • For each number, check if it is divisible by any number from 2 to itself-1

  • If not divisible by any number, it is a prime number

View 1 answer

Q4. how to create thread

Ans.

To create a thread in Java, you can extend the Thread class or implement the Runnable interface.

  • Extend the Thread class and override the run() method

  • Implement the Runnable interface and pass an instance to the Thread constructor

  • Start the thread using the start() method

  • Example: Thread thread = new Thread(() -> System.out.println("Hello World")); thread.start();

Add your answer
Discover SasteGhar.com interview dos and don'ts from real experiences

Q5. Overloading vs Overriding

Ans.

Overloading is having multiple methods with the same name but different parameters. Overriding is having a method in a subclass with the same name and parameters as a method in its superclass.

  • Overloading is compile-time polymorphism while overriding is runtime polymorphism

  • Overloading is used to provide different ways of calling a method with different parameters

  • Overriding is used to provide a specific implementation of a method in a subclass

  • Overloading can be done in the same...read more

Add your answer

Q6. Methods in thread

Ans.

Methods in thread are used to perform tasks concurrently.

  • Thread.start() method is used to start a new thread.

  • Thread.sleep() method is used to pause the execution of a thread.

  • Thread.join() method is used to wait for a thread to finish its execution.

  • Thread.yield() method is used to give a chance to other threads to execute.

Add your answer
Contribute & help others!
Write a review
Share interview
Contribute salary
Add office photos
Interview Tips & Stories
Ace your next interview with expert advice and inspiring stories

Top Java Developer Interview Questions from Similar Companies

3.5
 • 52 Interview Questions
3.9
 • 40 Interview Questions
3.9
 • 32 Interview Questions
4.1
 • 18 Interview Questions
4.6
 • 11 Interview Questions
3.3
 • 11 Interview Questions
View all
Share an Interview
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
70 Lakh+

Reviews

5 Lakh+

Interviews

4 Crore+

Salaries

1 Cr+

Users/Month

Contribute to help millions
Get AmbitionBox app

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter