Java

JDBC Examples

JDBC or Java Data Base Connectivity – provides an interface to Relational Data Sources JDBC library provides the means for executing SQL statements to access and operate on a relational database JDBC library is implemented in the java.sql package Set of classes and interfaces that provide a uniform API for access to broad range of …

JDBC Examples Read More »

Share

Java Multi Thread Example

Java Program to show Multi Threading class Ta extends Thread { public void run() { for(int i=1; i<=5; i++) { System.out.println(“A thread=” + i); } System.out.println(“Ta is over”); } } class Tb extends Thread { public void run() { for(int j=1; j<=5; j++) { System.out.println(“B thread=” + j); } System.out.println(“Tb is over”); } } class …

Java Multi Thread Example Read More »

Share

Java Inheritance and packages

Java Program to display Student Marks information using Single Inheritance. import java.io.*; class Student { int rollno; String nm; } class Marks extends Student { int p, c, m, tot; Marks() { try { DataInputStream in=new DataInputStream(System.in); System.out.print(“Enter Roll No:”); rollno=Integer.parseInt(in.readLine()); System.out.print(“Enter Name:”); nm=in.readLine(); System.out.print(“Enter Phy Marks:”); p=Integer.parseInt(in.readLine()); System.out.print(“Enter Che Marks:”); c=Integer.parseInt(in.readLine()); System.out.print(“Enter Maths Marks:”); …

Java Inheritance and packages Read More »

Share

Java Programs

List of Java Programs Java program – Type casting [converting from float to an integer] class Typecast { public static void main(String args[]) { float a=2.3333f; int b=10; int c=(int)a+b; System.out.println(c); } } Java Program – use of all data types. class vari { public static void main(String args[]) { int a=3; String str=”Hello World!”; …

Java Programs Read More »

Share

Java

An object-oriented, a cross platform programming language. It is used to create stand-alone applications, net based programs and programs for consumer devices. Example : cellular phones, palm pilots Features of Java:- Simple – The Java designers removed a number of complex features that existed in C, such as pointer manipulation, operator overloading etc. Object-Oriented – Everything is …

Java Read More »

Share

Java Programs – 2

1. Java program to find number of lines. import java.io.*; public class NOL { public static void main(String[] args) { try { System.out.println(“Getting line number of a paritcular file example!”); BufferedReader bf = new BufferedReader(new InputStreamReader(System.in)); System.out.println(“Please enter file name with extension:”); String str = bf.readLine(); File file = new File(str); if (file.exists()) { FileReader …

Java Programs – 2 Read More »

Share
Share
Scroll to Top