Java program to convert Fahrenheit scale to Celsius

This Java program source code converts temperature from Fahrenheit to Celsius scale. import java.util.*; class FahrenheitCelsius { public static void main(String[] args) { float temp; Scanner inn = new Scanner(System.in); System.out.print(“Enter temperature in Fahrenheit=”); temp= inn.nextInt(); temp = ((temp – 32)*5)/9; System.out.println(“Temperature in Celsius = ” + temp); } } In the above program, you … Read more

Java Program To Swap Two Numbers

Write a program in Java to Swap two digits using a third variable. import java.util.Scanner; class Swapping { public static void main(String args[]) { int first_no, sec_no, third_no; System.out.println(“Enter first_no and sec_no”); Scanner in = new Scanner(System.in); first_no = in.nextInt(); sec_no = in.nextInt(); System.out.println(“Before Swapping\nfirst_no = “+first_no+”\nsec_no = “+sec_no); third_no = first_no; first_no = sec_no; … Read more

How To Take Input From User In Java

In this tutorial, I am going to show you how to take input from users in Java using two different ways. You can follow any method(Scanner, Buffered) according to your convenience. To understand how we get input from users in Java we first must know the following two things : System.out – Java uses System.out to … Read more

AWT in Java

The Abstract Window Toolkit (AWT) is a Java package that provides a set of graphical user interface (GUI) components and tools for building GUIs in Java applications. AWT is part of the Java Foundation Classes (JFC) and is one of the core technologies used for creating graphical user interfaces in Java. The AWT package includes … Read more

ASCII in Java

ASCII ( American Standard Code for Information Interchange)  is a character encoding standard used in computers and communication equipment to represent text, control characters, and other data. ASCII was first developed in the 1960s and has been widely used since then. The ASCII standard uses a 7-bit binary code to represent each character, allowing for … Read more

Java Virtual Machine(JVM)

JVM stands for Java Virtual Machine. It is an integral part(crucial component) of the Java Runtime Environment (JRE) and Java Development Kit (JDK). The JVM is responsible for executing Java bytecode(intermediate code), which is the compiled form of Java source code. It acts as an abstract machine that provides a runtime environment for executing Java … Read more

Introduction to Java

Introduction to Java

Java is a high-level, object-oriented programming language(OOP (the program is divided into classes and objects)) that was developed by Sun Microsystems of USA (now owned by Oracle Corporation) in the mid-1990s. It was designed to be platform-independent, meaning that Java programs can run on any operating system or device that has a Java Virtual Machine … Read more

Java Data Types

Java Data Types

Before we talk about data type first we know about variables because data type is used with variables. Without variables the meaning of the data type is nothing, it’s incomplete. Data types are used when you create variables in the program. Each variable is assigned a data type. The variable is the name that is … Read more

Java Command Line Arguments

Java Command Line Arguments

In Java, command-line arguments can be passed to a program when executing it from the command line. These arguments allow you to provide inputs or configuration parameters to your Java program. Here’s how you can access command-line arguments in Java: Command-line arguments are passed to the main method of your Java program as an array … Read more