Write an infinite loop using do while condition.


import java.util.*;

 

public class Solutions {

   public static void main(String args[]) {

      do {

 

      } while(true);

   }   

}



Share to whatsapp

More Questions from Java Basic Codes Module 0

Write a function that takes in age as input and returns if that person is eligible to vote or not. A person of age > 18 is eligible to vote.


View

Write a function to multiply 2 numbers.


View

Two numbers are entered by the user, x and n. Write a function to find the value of one number raised to the power of another i.e. x^n.


View

Write a function to print the sum of all odd numbers from 1 to n.


View

Take an array of numbers as input and check if it is an array sorted in ascending order.

Eg : { 1, 2, 4, 7 } is sorted in ascending order.

       {3, 4, 6, 2} is not sorted in ascending order.


View

Print the spiral order matrix as output for a given matrix of numbers.


View

Write a program to print Fibonacci series of n terms where n is input by user :

0 1 1 2 3 5 8 13 21 ..... 

In the Fibonacci series, a number is the sum of the previous 2 numbers that came before it.


View