Blog

python tutorials and learn python

Created with Sketch.

Java hello world program

  Java hello world program “Hello world” program in Java to display “Hello world” on the screen. How to write hello world rogram in Java? class HelloWorld { public static void main(String args[]) { System.out.println(“Hello World”); } }   “Hello World” is passed as an argument, to the println method, you can print whatever you…
Read more

If else program in Java

  If else program in Java The if-else Java program uses if-else to execute statement(s) when a condition holds. Below is a simple application that explains the usage of if-else in Java programming language. In the program, a user input marks obtained in an exam, and we compare it with the minimum passing marks. We…
Read more

Java for loop

  Java for loop Java for loop is used to repeat the execution of the statement(s) until a certain condition holds. for is a keyword in Java programming language. Java for loop syntax for (/* Initialization of variables */ ; /*Conditions to test*/ ; /* Increment(s) or decrement(s) of variables */) { // Statements to…
Read more

Java while loop

  Java while loop In Java, a while loop is used to execute statement(s) until a condition is true. In this tutorial, we learn to use it with examples. First of all, let’s discuss its syntax: while (condition(s)) { // Body of loop } 1. If the condition(s) holds, then the body of the loop…
Read more

Java program to print alphabets

  Java program to print alphabets Java program to print letters (i.e., a, b, c, …, z in lower case) on the screen using a loop. Java program class Alphabets { public static void main(String args[]) { char t; for (t = ‘a’; t <= ‘z’; t++) // For upper case use ‘A’ and ‘Z’…
Read more

Multiplication table in Java

  Multiplication table in Java Java program to print multiplication table of a number entered by a user using a for loop. You can modify it for while or do while loop for practice. Using nested loops (a loop inside another loop), we can print tables of numbers between a given range say a to…
Read more

How to take input from a user in Java

  How to take input from a user in Java Java program to get input from a user, we are using Scanner class for it. The program asks the user to enter an integer, a floating-point number, and a string, and we print them on the screen. Scanner class is present in “java.util” package, so…
Read more

Even odd program in Java

  Even odd program in Java Java program to check whether a number is even or odd; if it’s divisible by two, then it’s even, otherwise, odd. We use the modulus operator to find the remainder. For an even number, it’s zero when it’s divided by two (it’s one for an odd number). Odd even…
Read more

Java program to convert Fahrenheit to Celsius

  Java program to convert Fahrenheit to Celsius Java program to convert Fahrenheit to Celsius: This code does temperature conversion from the Fahrenheit scale to the Celsius scale. For Celsius to Fahrenheit conversion use: T = 9*T/5 + 32 ‘T’ is the temperature on the Celsius scale. Java temperature conversion program import java.util.*; class FahrenheitToCelsius…
Read more

Java methods

  Java methods Java methods tutorial: Java program consists of one or more classes, and a class may contain method(s). A class can do very little without methods. In this tutorial, we learn about Java methods (known as functions in C and C++ programming languages). A method has a name and return type. The main…
Read more