Java Tutorials

java string tochararray() 0

Java String toCharArray() with Examples

The Java String class is a powerful and versatile tool for working with text-based data. Within its array of methods, the toCharArray() function stands out as a crucial function for developers. It enables the...

bus reservation system 0

Java Project – Bus Reservation System

Bus Reservation System with Graphical User Interface (GUI), developed in NetBeans Integrated Development Environment (IDE) using Java, is a powerful software solution that simplifies and improves your bus ticket booking experience. The system replaces...

Predefined Functional Interface in Java 0

Predefined Functional Interface in Java

Program 1 package test; import java.util.function.Consumer; import java.util.function.Predicate; import java.util.function.Function; import java.util.function.Supplier; //class Student //{ // private String stname; // // public String getStname() // { // return stname; // } // // public...

Types of Interface in Java 0

Types of Interface in Java

Program 1 // @FunctionalInterface // interface MyInter1 // { // void a1(); // } interface First { void a1(); } interface Second { void a2(); } class MyClass implements First,Second // Multiple Inheritance {...

Annotations Types in Java 0

Annotations Types in Java

Program 1 @FunctionalInterface interface MyInter { void display(); } class TestAnnotation { public static void main(String args[]) { MyInter M1=()->{System.out.println(“Hello Friends “);}; M1.display(); } } // class MyClass // { // void a1() //...

Serialization with Inheritance in Java 0

Serialization with Inheritance in Java

Program 1 import java.io.*; class Employee implements Serializable { int eid; String ename; int mobile; Employee(int eid,String ename,int mobile) { this.eid=eid; this.ename=ename; this.mobile=mobile; } } class EmployeeSalary extends Employee { String edept; int bs;...

NavigableSet in Java 0

NavigableSet in Java

Program 1 import java.util.*; class TestNavigable { public static void main(String args[]) { TreeSet<Double>t=new TreeSet<Double>(); t.add(11.30); t.add(11.45); t.add(12.55); t.add(12.60); // System.out.println(t); System.out.println(t.tailSet(11.30)); // TreeSet<Integer>t=new TreeSet<Integer>(); // t.add(100); // t.add(200); // t.add(300); // t.add(400); //...

Lambda Expression and Functional Interface in Java 0

Lambda Expression and Functional Interface in Java

Program 1 import java.util.*; @FunctionalInterface interface MyInter { public int mySquare(int n); } class TestLambda { public static void main(String args[]) { MyInter M1=(n)->{return(n*n);}; Scanner scan=new Scanner(System.in); int m,x; System.out.println(“Enter a number”); m=scan.nextInt(); x=M1.mySquare(m);...

Difference Between throw and throws 0

Difference Between throw and throws

Program 1 import java.util.*; import java.io.IOException; class Test { void first(int n) throws IOException { if(n%2==0) throw new IOException(” this is error in first method”); else System.out.println( “No is odd”); } void second(int n)...