Multi level inheritance in Java
The Tech Zone is built to promote open source technologies. Hadoop, Linux Administration, Cloud, Java Technologies, Operating Systems, Advanced Computer Programming, etc are the key areas of focus. Computer and IT engineering students can find important study material on this portal.
Friday, 28 September 2018
14 Runtime Polymorphism - Method Overriding - Dynamic Method Dispatch - Super Keyword in Java - Part B - Video
Runtime Polymorphism - Method Overriding - Dynamic Method Dispatch - Super Keyword in Java - Part B - Video
Thursday, 27 September 2018
14 Runtime Polymorphism - Method Overriding - Dynamic Method Dispatch in Java - Part A - Video
Runtime Polymorphism - Method Overriding - Dynamic Method Dispatch in Java - Part A
13 Compile Time Polymorphism - Method Overloading in Java Video
Compile Time Polymorphism - Method Overloading in Java
Monday, 24 September 2018
12 Java Inheritance & Type - Single Level Demo Video
Java Inheritance & Type - Single Level Demo Video
Saturday, 22 September 2018
8 Java Static - Variable, Method, Block Demonstration Video
Java Static - Variable, Method, Block Demonstration Video
Monday, 17 September 2018
6 Java Accept Input From Keyboard Using BufferedReader Class Video
Java Accept Input From Keyboard Using BufferedReader Class Video
7 Java Accept Input From Keyboard Using Scanner Class Video
Java Accept Input From Keyboard Using Scanner Class Video
Saturday, 15 September 2018
3 Java Student Class and Object Creation Demo Video
Java Student Class and Object Creation Demo Video
Wednesday, 21 March 2018
Monday, 12 March 2018
Simple EJB + JSP + Servlet Application.
This post will help you to create your first EJB + JSP + Servlet application.
Click here to download a file that includes EJB information and execution steps
Click here to download a Netbeans project
Wednesday, 21 February 2018
HANDS-ON WORKSHOP on "BIG DATA ANALYSIS USING HADOOP"
Dear All,
Dept of Comp Engg at PICT Pune announces
TWO DAYS HANDS-ON WORKSHOP on "BIG DATA ANALYSIS USING HADOOP"
Date : 25th & 26th February 2018.
Considering current industry requirements following will be the workshop contents:
Hadoop configuration and administration,
HDFS, Map Reduce programming, Hive and Sqoop.
Registration Fee :
Rs.
500/- per participant (For All Faculty, Students, Industry Person)
which includes registration kit, course material, certificate, breakfast
and lunch.
For Pre Registration Fill Following Registration Form
For further information please contact to:
Prof. Swarup Suradkar
7249324171
Mr.Pavan R.Jaiswal
9545200881
Prof. Bhumesh Masram
7045449943
Convener:
Prof. Swarup Suradkar
Please share this among your references.
Thank you.
Monday, 19 February 2018
First Servlet using Interface - Servlet without IDE
Dear viewers,
you may use following steps to execute your first HelloWorld servlet. I have executed this on Fedora 17 with the help of Apache 8.0.27
You may even download the complete project (context-root) which is attached at the end of this post.
We are ready to go .......
you may use following steps to execute your first HelloWorld servlet. I have executed this on Fedora 17 with the help of Apache 8.0.27
You may even download the complete project (context-root) which is attached at the end of this post.
We are ready to go .......
Monday, 15 January 2018
Throw, Thorws and Finally in Java
/*
* throw, throws and finally together
*/
package corejava;
/**
*
* @author pavan
*/
public class ThrowThrowsDemo {
void check() throws ArithmeticException{ // use throws to specify possible exceptions
System.out.println("Inside check method");
throw new ArithmeticException(); // use throw to throw exception explicitely
}
* throw, throws and finally together
*/
package corejava;
/**
*
* @author pavan
*/
public class ThrowThrowsDemo {
void check() throws ArithmeticException{ // use throws to specify possible exceptions
System.out.println("Inside check method");
throw new ArithmeticException(); // use throw to throw exception explicitely
}
Divide by Zero Exception Handling in Java
/*
* Exception handling Divide by zero
*/
package corejava;
/**
*
* @author pavan
*/
public class DivideByZero {
public static void main(String args[]) {
try {
for (int i = 5; i >= 0; i--) {
System.out.println(10 / i);
}
} catch (Exception e) {
System.out.println("Exception occured .."+ e.getMessage());
e.printStackTrace();
}
}
}
/*
OUUPUT
2
java.lang.ArithmeticException: / by zero
2
3
5
10
Exception occured ../ by zero
at corejava.DivideByZero.main(DivideByZero.java:16)
*/
* Exception handling Divide by zero
*/
package corejava;
/**
*
* @author pavan
*/
public class DivideByZero {
public static void main(String args[]) {
try {
for (int i = 5; i >= 0; i--) {
System.out.println(10 / i);
}
} catch (Exception e) {
System.out.println("Exception occured .."+ e.getMessage());
e.printStackTrace();
}
}
}
/*
OUUPUT
2
java.lang.ArithmeticException: / by zero
2
3
5
10
Exception occured ../ by zero
at corejava.DivideByZero.main(DivideByZero.java:16)
*/
Array in Java
/*
* One dimensional Array demonstration
*/
package corejava;
/**
*
* @author pavan
*/
public class ArrayDemo {
int arr[] = new int[3]; // array creation, do not mention size on left hand side
int arr2[] = {50,60}; //another way to initialize
int arr3[][] = {{1,2,3},{4,5,6},{7,8,9}}; // declaring and initialiazing multi dimensional array
void setArray(){ // array initialization
arr[0] = 10;
arr[1] = 20;
arr[2] = 30;
}
* One dimensional Array demonstration
*/
package corejava;
/**
*
* @author pavan
*/
public class ArrayDemo {
int arr[] = new int[3]; // array creation, do not mention size on left hand side
int arr2[] = {50,60}; //another way to initialize
int arr3[][] = {{1,2,3},{4,5,6},{7,8,9}}; // declaring and initialiazing multi dimensional array
void setArray(){ // array initialization
arr[0] = 10;
arr[1] = 20;
arr[2] = 30;
}
Interface in Java
/*
* Interface
*/
package corejava;
/**
*
* @author pavan
*/
interface Bank{
double getROI();
}
class AXIS implements Bank{
public double getROI(){
return 8.5;
}
}
class HDFC implements Bank{
public double getROI(){
return 8.35;
}
}
* Interface
*/
package corejava;
/**
*
* @author pavan
*/
interface Bank{
double getROI();
}
class AXIS implements Bank{
public double getROI(){
return 8.5;
}
}
class HDFC implements Bank{
public double getROI(){
return 8.35;
}
}
Abstract class in Java
/*
* Abstract class and abstract method
*/
package corejava;
/**
*
* @author pavan
*/
abstract class Shape {
abstract void draw();
}
class Circle extends Shape {
void draw() {
System.out.println("Drawing circle...");
}
}
* Abstract class and abstract method
*/
package corejava;
/**
*
* @author pavan
*/
abstract class Shape {
abstract void draw();
}
class Circle extends Shape {
void draw() {
System.out.println("Drawing circle...");
}
}
Single Level Inheritance in Java
/*
* Interface
*/
package corejava;
/**
*
* @author pavan
*/
interface Bank{
double getROI();
}
class AXIS implements Bank{
public double getROI(){
return 8.5;
}
}
* Interface
*/
package corejava;
/**
*
* @author pavan
*/
interface Bank{
double getROI();
}
class AXIS implements Bank{
public double getROI(){
return 8.5;
}
}
Static varible in Java
package corejava;
/*
* With static members
*/
/**
*
* @author pavan
*/
public class WithStatic {
static int counter = 0; // only once memory will be given, rest of instance will share memory
WithStatic(){
counter++;
System.out.println(counter);
}
public static void main(String args[]){
WithStatic ob1 = new WithStatic();
WithStatic ob2 = new WithStatic();
WithStatic ob3 = new WithStatic();
}
}
/*
OUTPUT
1
2
3
*/
/*
* With static members
*/
/**
*
* @author pavan
*/
public class WithStatic {
static int counter = 0; // only once memory will be given, rest of instance will share memory
WithStatic(){
counter++;
System.out.println(counter);
}
public static void main(String args[]){
WithStatic ob1 = new WithStatic();
WithStatic ob2 = new WithStatic();
WithStatic ob3 = new WithStatic();
}
}
/*
OUTPUT
1
2
3
*/
POJO - Plain Old Java Object Demonstration
/*
* POJO - Plain Old Java Object
* Link: https://www.quora.com/What-is-POJO-in-Java
*/
package corejava;
/**
*
* @author pavan
*/
public class POJO {
int id;
String name;
String dept;
int getId(){
return id;
}
void setId(int id){
this.id = id;
}
* POJO - Plain Old Java Object
* Link: https://www.quora.com/What-is-POJO-in-Java
*/
package corejava;
/**
*
* @author pavan
*/
public class POJO {
int id;
String name;
String dept;
int getId(){
return id;
}
void setId(int id){
this.id = id;
}
Constructors in Java
/*
* Demonstrating constructors
*/
package corejava;
/**
*
* @author pavan
*/
class Employee{
int eId;
String eName, eDept;
Employee(){ //default contructor
eId = 0;
eName = "";
eDept = "";
}
* Demonstrating constructors
*/
package corejava;
/**
*
* @author pavan
*/
class Employee{
int eId;
String eName, eDept;
Employee(){ //default contructor
eId = 0;
eName = "";
eDept = "";
}
Accept Input from User using Scanner class and BufferedReader class in Java
/*
* Accept two numbers from user and perform addition
* Classes used: Scanner, BufferedReader
* To know difference between both classes you may refer:
* https://www.geeksforgeeks.org/difference-between-scanner-and-bufferreader-class-in-java/
*/
package corejava;
import java.util.Scanner;
import java.io.BufferedReader;
import java.io.InputStreamReader;
/**
*
*
* @author pavan
*/
public class AcceptInput {
int num1, num2;
void usingScannerClass(){
Scanner scan = new Scanner(System.in); // import java.util
System.out.println("Using Scanner Class");
System.out.println("Enter first number");
num1 = scan.nextInt(); // implicit parsing
System.out.println("Enter second number");
num2 = scan.nextInt();
}
* Accept two numbers from user and perform addition
* Classes used: Scanner, BufferedReader
* To know difference between both classes you may refer:
* https://www.geeksforgeeks.org/difference-between-scanner-and-bufferreader-class-in-java/
*/
package corejava;
import java.util.Scanner;
import java.io.BufferedReader;
import java.io.InputStreamReader;
/**
*
*
* @author pavan
*/
public class AcceptInput {
int num1, num2;
void usingScannerClass(){
Scanner scan = new Scanner(System.in); // import java.util
System.out.println("Using Scanner Class");
System.out.println("Enter first number");
num1 = scan.nextInt(); // implicit parsing
System.out.println("Enter second number");
num2 = scan.nextInt();
}
Demonstrating Ternary Operator in Java
/*
* Demonstrating ternary operator example
*/
package corejava;
/**
*
* @author pavan
*/
public class TernaryOperator {
public static void main(String args[]){
int num1 = 10;
int num2 = 30;
System.out.println("Greater No: "+((num1>num2)?num1:num2));
}
}
/*
OUTPUT
Greater No: 30
*/
* Demonstrating ternary operator example
*/
package corejava;
/**
*
* @author pavan
*/
public class TernaryOperator {
public static void main(String args[]){
int num1 = 10;
int num2 = 30;
System.out.println("Greater No: "+((num1>num2)?num1:num2));
}
}
/*
OUTPUT
Greater No: 30
*/
Variable Demo in Java
/*
* Demonstrating local, instance and static varibles
*/
package corejava;
/**
*
* @author pavan
*/
public class VariablesDemo {
int instanceVar =10;
static int statVar = 20;
public void checkValues(){
int localVar = 30;
System.out.println("Instance Var: "+ instanceVar); // call to instance var
System.out.println("Static Var: "+ statVar); // call to static var
System.out.println("Local Var: "+ localVar); // call to local var
}
* Demonstrating local, instance and static varibles
*/
package corejava;
/**
*
* @author pavan
*/
public class VariablesDemo {
int instanceVar =10;
static int statVar = 20;
public void checkValues(){
int localVar = 30;
System.out.println("Instance Var: "+ instanceVar); // call to instance var
System.out.println("Static Var: "+ statVar); // call to static var
System.out.println("Local Var: "+ localVar); // call to local var
}
Installation of jdk-1.8.xxx on Fedora
Dear Viewer
Follow the below mentioned steps to install / upgrade jdk version on your Linux box.
Follow the below mentioned steps to install / upgrade jdk version on your Linux box.
JDK1.8.0_151
installation steps
[pavan@Pavan opt]$ su
Password:
[root@Pavan opt]# pwd
/opt
[root@Pavan opt]#
[root@Pavan opt]# wget
--no-cookies --no-check-certificate --header "Cookie:
gpw_e24=http%3A%2F%2Fwww.oracle.com%2F;
oraclelicense=accept-securebackup-cookie"
"http://download.oracle.com/otn-pub/java/jdk/8u151-b12/e758a0de34e24606bca991d704f6dcbf/jdk-8u151-linux-x64.tar.gz"
--2018-01-15 18:25:57--
http://download.oracle.com/otn-pub/java/jdk/8u151-b12/e758a0de34e24606bca991d704f6dcbf/jdk-8u151-linux-x64.tar.gz
Resolving
download.oracle.com... 23.66.247.173
Connecting to
download.oracle.com|23.66.247.173|:80... connected.
HTTP request sent,
awaiting response... 302 Moved Temporarily
Location:
https://edelivery.oracle.com/otn-pub/java/jdk/8u151-b12/e758a0de34e24606bca991d704f6dcbf/jdk-8u151-linux-x64.tar.gz
[following]
--2018-01-15 18:25:57--
https://edelivery.oracle.com/otn-pub/java/jdk/8u151-b12/e758a0de34e24606bca991d704f6dcbf/jdk-8u151-linux-x64.tar.gz
Resolving
edelivery.oracle.com... 23.211.219.179, 2600:1417:2c:183::2d3e,
2600:1417:2c:190::2d3e
Connecting to
edelivery.oracle.com|23.211.219.179|:443... connected.
HTTP request sent,
awaiting response... 302 Moved Temporarily
Location:
http://download.oracle.com/otn-pub/java/jdk/8u151-b12/e758a0de34e24606bca991d704f6dcbf/jdk-8u151-linux-x64.tar.gz?AuthParam=1516021067_f2db42d3f19a78350632a1e8f269fe63
[following]
--2018-01-15 18:25:58--
http://download.oracle.com/otn-pub/java/jdk/8u151-b12/e758a0de34e24606bca991d704f6dcbf/jdk-8u151-linux-x64.tar.gz?AuthParam=1516021067_f2db42d3f19a78350632a1e8f269fe63
Connecting to
download.oracle.com|23.66.247.173|:80... connected.
HTTP request sent,
awaiting response... 200 OK
Length: 189736377
(181M) [application/x-gzip]
Saving to:
`jdk-8u151-linux-x64.tar.gz'
100%[==========================================>]
189,736,377 401K/s in 9m 4s
2018-01-15 18:35:02
(340 KB/s) - `jdk-8u151-linux-x64.tar.gz' saved [189736377/189736377]
Subscribe to:
Posts (Atom)