Java Tutorials

Java Program For Conditional Operators 0

Java Program For Conditional Operators

Program 1 class TestCondition { public static void main(String args[]) { char ch=’t’ ; String str; str=(ch==’a’ || ch==’e’ || ch==’i’ || ch==’o’|| ch==’u’ ||ch==’A’ || ch==’E’ || ch==’I’ || ch==’O’|| ch==’U’ ) ?...

Java Program For Arithmetic Operators 0

Java Program For Arithmetic Operators

Program 1 class TestData1 { public static void main(String args[]) { byte a=50,b=30; System.out.println(“Before swaping” + a + ” ” +b); a=(byte)(a+b); b=(byte)(a-b); a=(byte)(a-b); System.out.println(“After swaping” + a + ” ” +b); } }...

Java Program on How to Print Data with Different Formats 0

Java Program on How to Print Data with Different Formats

Program 1 class TestPrint { public static void main(String args[]) { int a=50,b=30,c; // System.out.println(a+b); // 80 // System.out.println(a+” “+b); // 50 30 // c=a+b; // System.out.println(“Addition is: ” +c); System.out.println(“Addition is: ” +(a...

Java Program For Number System 0

Java Program For Number System

program 1 class TestInteger { public static void main(String args[]) { // int a=013,b=010,c; /// c=a+b; // System.out.println(c); int a=0x1A; System.out.println(a); // int a=015,b=0x23,c; // c=a+b; // System.out.println(c); } }

Java Program for Type Conversion 0

Java Program for Type Conversion

Program 1 class Test2 { public static void main(String args[]) { // byte a=(byte)(130); // short s=32770; // int i=13; // byte b; // b=(byte)(i); byte b=20; int i; i=b; System.out.println(i); } } Program...

Java Program For Decimal Data Type 0

Java Program For Decimal Data Type

Program 1 class TestDecimal { public static void main(String args[]) { float f=12.555f; System.out.println(f); /* float a, r=12.34f; final float PI=3.14f; a=PI*r*r; System.out.println(“\n Area is: “+a); */ } }    

this is keyword in java 0

this keyword in Java

The ‘this’ keyword in Java is a fundamental element of object-oriented programming, serving as a reference variable that plays a pivotal role in establishing a strong connection between an object and its associated methods...

java while loop 0

Java While Loop with Examples

The while loop is a control flow statement in Java that allows code to be executed repeatedly based on a given Boolean condition. The while loop is useful when the number of iterations is...