Learning Python 5th Edition by Mark Lutz Pdf Download

Learning Python 5th edition by Mark Lutz is one of the best and most popular book for learning python programming for beginners. This book includes quizzes, exercises and illustrations that are very helpful in learning python language in depth. In this article I am sharing the link to download its pdf version for free.

Learning Python 5th Edition by Mark Lutz Pdf Download

Book Name: Learning Python 5th Edition
Author: Mark Lutz
Size: 20.2 MB

Table of Contents

Getting Started
Chapter 1: A Python Q&A Session
Chapter 2: How Python Runs Programs
Chapter 3: How You Run Programs
Chapter 4: Introducing Python Object Types
Chapter 5: Numeric Types
Chapter 6: The Dynamic Typing Interlude
Chapter 7: String Fundamentals
Chapter 8: Lists and Dictionaries
Chapter 9: Tuples, Files, and Everything Else
Chapter 10: Introducing Python Statements
Chapter 11: Assignments, Expressions, and Prints
Chapter 12: if Tests and Syntax Rules
Chapter 13: while and for Loops
Chapter 14: Iterations and Comprehensions
Chapter 15: The Documentation Interlude
Chapter 16: Function Basics
Chapter 17: Scopes
Chapter 18: Arguments
Chapter 19: Advanced Function Topics
Chapter 20: Comprehensions and Generations
Chapter 21: The Benchmarking Interlude
Chapter 22: Modules: The Big Picture
Chapter 23: Module Coding Basics
Chapter 24: Module Packages
Chapter 25: Advanced Module Topics
Chapter 26: OOP: The Big Picture
Chapter 27: Class Coding Basics
Chapter 28: A More Realistic Example
Chapter 29: Class Coding Details
Chapter 30: Operator Overloading
Chapter 31: Designing with Classes
Chapter 32: Advanced Class Topics
Chapter 33: Exception Basics
Chapter 34: Exception Coding Details
Chapter 35: Exception Objects
Chapter 36: Designing with Exceptions
Chapter 37: Unicode and Byte Strings
Chapter 38: Managed Attributes
Chapter 39: Decorators
Chapter 40: Metaclasses
Chapter 41: All Good Things
Appendixes
Colophon

- Click Here To Download Learning Python 5th Edition Pdf -


Top 5 Best C/C++ IDEs

An integrated development environment (IDE) or interactive development environment is software that provides facilities to programmers for software development. An IDE consists of a source code editor and compiler. Working in IDE really make our programming more interesting and easy because it has many interesting features like syntax highlighting, code completion, tabbed interface, smart indent and many more.

Top 5 Best C/C++ IDE

In this article I am sharing the list of top 5 best C/C++ IDEs that are very popular among programmers and available on the internet for free.

Also Read: 15 Common Errors in C and C++ Programming

List of Top 5 Best C/C++ IDEs

Eclipse

Eclipse

Eclipse IDE is mainly famous for Java but its C/C++ IDE is also cool. It has awesome features like code highlighting, auto code completion and debugger. Eclipse IDE is available for Windows, Linux and Mac OS X.

Netbeans

Netbeans

Netbeans is another popular IDE that is widely used by programmers. It is also mainly famous for Java same as like Eclipse IDE. Netbeans has all the features that Eclipse has and it also offers some advance features. Netbeans IDE is available for Windows, Linux and Mac OS X.

Code::Blocks

Code::Blocks

Code::Blocks IDE is open source and cross platform IDE that is being widely used by programmers for C/C++ programing. It supports multiple compilers and consists of various features like syntax highlighting, code completion, tabbed interface and smart indent.

Dev-C++

Dev-C++

Dev-C++ is a fast IDE that can work in a computer with low configurations (Windows 95 or higher, minimum 32 MB of RAM). Some of the features of Dev-C++ are, support GCC-based compilers, integrated debugging, class Browser, code completion, debug variable browser and many more. It is available for only Windows.

CodeLite


CodeLite

CodeLite is an open source, free and cross platform IDE for C/C++ programming which runs on all major Platforms (Mac OS X, Windows and Linux). Some of the features of CodeLite IDE are, refactoring, code completion, code navigation, built-in SFTP.

Please do share if you liked this article!

Effective Java 2nd Edition Pdf Download

If you are looking for the best book for learning Java programming then Effective Java written by Joshua Bloch is the best option. This book is not recommend for beginners, it is useful for those who have already completed beginner Java course. By reading this book you can improve your logic, coding skills and hence build your Java language knowledge more effective. In this article I am sharing the link to download its pdf version.

Effective Java 2nd Edition Pdf Download

Book Name: Effective Java
Author: Joshua Bloch
Size: 5.4 MB

Table of Contents

Foreword
Preface
Acknowledgments
Introduction
Creating and Destroying Objects
Methods Common to All Objects
Classes and Interfaces
Generics
Enums and Annotations
Methods
General Programming
Exceptions
Concurrency
Serialization
Appendix: Items Corresponding to First Edition
References
Index

- Click Here to Download Effective Java Pdf -


Make Analog Clock in C Using Graphics

In this tutorial you will learn how you can create an analog clock in C using graphics. This tutorial is written in a way that a beginner C graphics programmer can also understand.

Before getting into the main let me explain the functions I have used in the program.

Also Read: C/C++ Program to Create a Digital Stopwatch
Also Read: Simple program to create a circular loading bar using graphics

clockLayout()
I've used this function to print the clock layout i.e. clock dial and the markings on the clock. If we observe clearly, the clock has hours marking each separated by 30 degrees and each hour is divided into 5 markings each making an angle of 6 degrees. So, iterating the markings for every 30 degrees gives hours and iterating markings with 6 degrees give minutes markings on the clock. The clock would look like this after executing this function.

Make Analog Clock in C Using Graphics

secHand()
It is clear from the name that this gonna do something with the seconds hand. This function is going to get the present second from the system clock and incline the line according to a particular angle. Eg: if the present seconds is 5 then the angle of the seconds hand with respect to the vertical must be 30 degrees, i.e. 5*6=30.

minHand()
This function fulfills the task of moving the minutes hand based on the system clock. The minutes hand must be inclined 6 degrees for every minute passing. Eg: if the elapsed minutes are 30 then the minutes hand angle must be making 180 degrees with the vertical.

hrHand()
This function is going to print an inclined hours line. The function is designed to get the present hour and also the no. of elapsed minutes from the system clock and incline the line according to a particular angle. For every hour elapsed the hour hand moves 30 degrees and every 12 minutes it moves 6 degrees.

main()
The first lines in main are graphic initialization, you must change the path "c:\\turboc3\\bgi\\" to your compiler's BGI file path otherwise program will not work. Coming to the while loop, the while loop iterates for every 100 milliseconds reprinting all the functions. This program is like getting the static picture of clock every second and combining all the pictures to make a moving analog clock.

Also Read: Simple program to create a moving car in graphics

Check out this video for demo


Program for Analog Clock in C

/* Graphical Analog Clock designed in C*/
/*Note press ctrl+pause break to stop the clock while executing in TC*/

#include<stdio.h>
#include<graphics.h>
#include<stdlib.h>
#include<math.h>
#include<dos.h>
#include<time.h>

#define PI 3.147

void clockLayout();
void secHand();
void hrHand();
void minHand();
int maxx,maxy;

void main()
{
 int gdriver=DETECT,gmode,error;
 initgraph(&gdriver,&gmode,"c:\\turboc3\\bgi\\");
 error=graphresult();
 if(error!=grOk)
 {
  printf("Error in graphics, code= %d",grapherrormsg(error));
  exit(0);
 }

 while(1)
 {
  clockLayout();
  secHand();
  minHand();
  hrHand();
  sleep(1);                /* pausing the outputscreen for 1 sec */
  cleardevice();           /* clearing the previous picture of clock */
 }
}

void clockLayout()
{
 int i,x,y,r;
 float j;
 maxx=getmaxx();
 maxy=getmaxy();

 for(i=1;i<5;i++)
 {                   /* printing a round ring with outer radius of 5 pixel */
  setcolor(YELLOW);
  circle(maxx/2,maxy/2,120-i);
 }

 pieslice(maxx/2,maxy/2,0,360,5);    /* displaying a circle in the middle of clock */
 x=maxx/2+100;y=maxy/2;
 r=100;
 setcolor(BLUE);

 for(j=PI/6;j<=(2*PI);j+=(PI/6))
 {    /* marking the hours for every 30 degrees */
  pieslice(x,y,0,360,4);
  x=(maxx/2)+r*cos(j);
  y=(maxy/2)+r*sin(j);
 }

 x=maxx/2+100;y=maxy/2;
 r=100;
 setcolor(RED);

 for(j=PI/30;j<=(2*PI);j+=(PI/30))
 {  /* marking the minutes for every 6 degrees */
  pieslice(x,y,0,360,2);
  x=(maxx/2)+r*cos(j);
  y=(maxy/2)+r*sin(j);
 }
}

void secHand()
{
 struct time t;
 int r=80,x=maxx/2,y=maxy/2,sec;
 float O;

 maxx=getmaxx();maxy=getmaxy();
 gettime(&t);                     /*getting the seconds in system clock */
 sec=t.ti_sec;
 O=sec*(PI/30)-(PI/2);           /* determining the angle of the line with respect to vertical */
 setcolor(YELLOW);
 line(maxx/2,maxy/2,x+r*cos(O),y+r*sin(O));
}

void hrHand()
{
 int r=50,hr,min;
 int x,y;
 struct time t;
 float O;

 maxx=getmaxx();
 maxy=getmaxy();
 x=maxx/2,y=maxy/2;
 gettime(&t);                     /*getting the seconds in system clock */
 hr=t.ti_hour;
 min=t.ti_min;

 /* determining the angle of the line with respect to vertical */
 if(hr<=12)O=(hr*(PI/6)-(PI/2))+((min/12)*(PI/30));
 if(hr>12) O=((hr-12)*(PI/6)-(PI/2))+((min/12)*(PI/30));
 setcolor(BLUE);
 line(maxx/2,maxy/2,x+r*cos(O),y+r*sin(O));
}

void minHand()
{
 int r=60,min;
 int x,y;
 float O;
 struct time t;
 maxx=getmaxx();
 maxy=getmaxy();
 x=maxx/2;
 y=maxy/2;
 gettime(&t);  /*getting the seconds in system clock */
 min=t.ti_min;
 O=(min*(PI/30)-(PI/2)); /* determining the angle of the line with respect to vertical */
 setcolor(RED);
 line(maxx/2,maxy/2,x+r*cos(O),y+r*sin(O));
}

About Author
Prathap is a passionate blogger and a very good programmer presently studying B.Tech in Computer Science. He is fascinated of latest technology, gadgets and also love to exploit technology and learn new tips and tricks in internet. He is the founder of Tech Google.

Java: A Beginner's Guide Sixth Edition Pdf Download

Java: A Beginner's Guide written by Herbert Schildt is at the first position in the list of top 5 best java programming books. This book is written specially for java beginners for easy learning. Herbert Schildt has written another popular java programming book, Java The Complete Reference. I highly recommend you to start learning java from this book. In this article I am sharing the link to download the pdf version of Java: A Beginner's Guide.

Java: A Beginner's Guide Sixth Edition Pdf Download

Table of Contents

Java Fundamentals
Introducing Data Types and Operators
Program Control Statements
Introducing Classes, Objects, and Methods
More Data Types and Operators
A Closer Look at Methods and Classes
Inheritance
Packages and Interfaces
Exception Handling
Using I/O
Multithreaded Programming
Enumerations, Autoboxing, Static Import, and Annotations
Generics
Applets, Events, and Miscellaneous Topics
Introducing Swing
Answers to Self Tests
Using Java's Documentation Comment
Index

Book Name: Java: A Beginner's Guide Sixth Edition
Author: Herbert Schildt
Size: 11.3 MB

- Click Here to Download Java: A Beginner's Guide Pdf -



Top 5 Best Java Programming Books

Which is the best java programming book? This is the first question that comes in our mind when we start learning java programming. So in this article I have made a list of top 5 best java programming books on the basis of their popularity. These books are written for easy learning and are highly recommended for beginners.

List of Top 5 Best Java Programming Books

Java: A Beginner's Guide

Java: A Beginner's Guide

Table of Contents

Java Fundamentals
Introducing Data Types and Operators
Program Control Statements
Introducing Classes, Objects, and Methods
More Data Types and Operators
A Closer Look at Methods and Classes
Inheritance
Packages and Interfaces
Exception Handling
Using I/O
Multithreaded Programming
Enumerations, Autoboxing, Static Import, and Annotations
Generics
Applets, Events, and Miscellaneous Topics
Introducing Swing
Answers to Self Tests
Using Java's Documentation Comment
Index

Head First Java

Head First Java

Table Of Contents

Introduction
Breaking the Surface: a quick dip
A Trip to Objectville: yes there will be Object
Know Your Variables: primitives and references
How Objects Behave: object state affects method &Junior
Extra-Strength Methods: flow control operations, and more
Using the Java Library: so you don't have to write it all yourself
Better Living in Objectville: planning for the future
Serious Polymorphism: exploiting abstract Classes and interfaces
Life and Death of an Object: constructors and memory management
Numbers Matter: math, formatting, wrappers; and statics
Risky Behavior: exception handing'
A Very Graphic Story: intro to GUI, event handling, and inner classes
Work on Your Swing: layout managers to subcomponents
Saving Object: serialization and I/0
Make a Connection: networking sockets and multi-threading
Data Structures: collections and genetics
Release Your Code: packaging and deployment
Distributed Computing: RMI with a dash of serialize, EJE, and Jini
Appendix A: Fatal code kitchen
Appendix B: To 7th Mugs that &diet make it into the rest of the book
Index

Effective Java

Effective Java

Table of Contents

Foreword
Preface
Acknowledgments
Introduction
Creating and Destroying Objects
Methods Common to All Objects
Classes and Interfaces
Generics
Enums and Annotations
Methods
General Programming
Exceptions
Concurrency
Serialization
Appendix: Items Corresponding to First Edition
References
Index

Java - The Complete Reference

Java - The Complete Reference

Table of Contents

Part I: The Java Language
The History and Evolution of Java
An Overview of Java
Data Types, Variables and Arrays
Operators
Control Statements
Introducing Classes
A Closer Look at Methods and Classes
Inheritance
Packages and Interfaces
Exception Handling
Multithreaded Programming
Enumerations, Auto-boxing and Annotations (Meta-data)
I / O, Applets and Other Topics
Generics
Lambda Expressions

Part II: The Java Library
String Handling
Exploring java.lang
Java.util Part 1 - The Collections Framework
Java.util Part 2 - More Utility Classes
Input / Output - Exploring Java.io
Exploring NIO
Networking
The Applet Class
Event Handling
Introducing the AWT - Working with Windows, Graphics and Text
Using AWT Controls, Layout Managers and Menus
Images
The Co-currency Utilities
The Stream API
Regular Expressions and Other Packages

Part III: Introducing GUI Programming with Swing
Introducing Swing
Exploring Swing
Introducing Swing Menus

Part IV: Introducing GUI Programming with JavaFX
Introducing JavaFX GUI Programming
Exploring JavaFX Controls
Introducing JavaFX Menus

Part V: Applying Java
Java Beans
Introducing Servlets

Appendix: Using Java’s Documentation Comments
Index

Programming With Java

Programming With Java

Table of Contents

Chapter 1: Fundamentals of Object-Oriented Programming
Chapter 2: Java Evolution
Chapter 3: Overview of Java Language
Chapter 4: Constants, Variable and Data types
Chapter 5: Operators and Expressions
Chapter 6: Decision Making and Branching
Chapter 7: Decision Making and Looping
Chapter 8: Classes, Objects and Methods
Chapter 9: Arrays, Strings and Vectors
Chapter 10: Interfaces: Multiple Inheritance
Chapter 11: Packages: Putting Classes Together
Chapter 12: Multithreading Programming
Chapter 13: Managing Error and Exceptions
Chapter 14: Applet Programming
Chapter 15: Graphics Programming
Chapter 16: Managing Inputs/Output Files in Java
Chapter 17: Java Collections

Appendices
Appendix A: Java Language Reference
Appendix B: Java Keywords
Appendix C: Difference between Java C/C++
Appendix D: Bit-level Programming
Appendix E: Java API Packages
Appendix F: Java Classes and their Packages
Appendix G: Assertion and Design by Contract
Appendix H: Java Version History
Appendix I: Deprecated Classes and Methods
Appendix J: Statistics of Java Packages
Appendix K: SCJP Exam Model Questions
Appendix L: Points to Remember
Appendix M: Common Coding Errors
Appendix N: Glossary of Java Terms
Appendix O: Projects

Bibliography
Index

Super Keyword in Java

Super refer to parent class. It holds the reference id of parent section of child class object. Observe below example.

class A
{
                int x=10;
}

class B extends A
{
                int x=20;

}

Super Keyword in Java

Here you can see that in child object, two separate sections are created namely parent section and child section. So super actually refer to parent section.

Use of Super Keyword in Java

There are three usage of super keyword in java.
  • Access parent class instance variable.
  • Invoke parent class method.


Below program will show all the three usage of super keyword.

class parent
{
                int x=20;              
                parent()
                {
                                System.out.println("Parent");
                }

                void show()
                {
                                System.out.println("Parent Show");
                }
}

class child extends parent
{
                int x=30;

                child()
                {
                                super();                                //invoke parent constructor
                }

                void show()
                {
                                System.out.println("Child Show");
                }

                void display()
                {
                                System.out.println(x);                   //print child x
                                System.out.println(super.x);      //print parent x

                                show();                                //invoke child show()
                                super.show();   //invoke parent show()
                }

                public static void main(String...s)
                {
                                child c=new child();
                                c.display();
                }
}                  
           
Super Keyword in Java - Output

  • Here both the classes have variable x and method show(). To access variable of child class we simply write x and to access variable of parent class we write super.x.
  • Similarly, to invoke method of child we simple write show() and to invoke method of parent we write super.show(). In this way super is also used to remove the problem of method overriding.
  • super() must be first line of the constructor. In above example we have written super() in first line of child class constructor to call parent class constructor.
  • Super can’t be used in static method.
  • By default super is first line of constructor. Super keyword and this keyword can’t be used together in constructor.

iCloud - How to Backup iPhone Data

Synchronizing data across multiple computers and devices has always posed as a huge challenge for people who need to access their crucial data on round-the-clock basis. Thanks to the iCloud service, Apple product consumers have now got relief from the issues faced during storage and access of data that needs to be shared with others. Gone are the days when entrepreneurs used to install an add-on software and instigate greater employee co-ordination for keeping the data in sync across different gadgets.

iCloud - How to Backup iPhone Data

With iCloud- Apple's best web-based data storage and syncing service, sharing data including calendars, contacts, emails, photos, videos etc. And that's not all, you can even backup all your iPhone data with the help of the iCloud service. This post will tell you how to proceed ahead with the same.

A brief on iCloud Backups 

Companies which are offering iPhone Application Development Service are encouraging their clients to backup all the iPhone data using the very popular iCloud service. With iCloud set up onto your device, you can expect all your iPhone data to automatically backup to your iCloud account available online. However, it is important to know that iCloud doesn't backup all your videos, photos and files and so you'll be required to back up the same using a manual approach that will be discussed rightaway. Do remember that the automatic back up of your iPhone using iCloud takes place only when your phone is plugged in, locked and connected to a smooth Wi-Fi network.

Also Read: An Insight into Apple iMovie app and its New Version 10.0.4

Yet another vital fact about iCloud backups is that with them you can only backup data and settings that are stored on your device. You won't be able to backup data that's already stored in iCloud, including: calendars, contacts, mail messages, bookmarks, shared photo streams, My Photo Stream and all the documents that have been saved into the iCloud account via the useful iOS apps.

What all can be backed up?

Well, Apple's iCloud service allows you to backup the following:
  • Apps
  • Photos in the Camera Roll
  • Videos in the Camera Roll
  • Music that has been purchased through Apple's iTunes service
  • Notes available in the Notes app
  • App data
  • Messages including SMSs, MMSs and iMessage
  • Ringtones
  • Visual Voicemail

What all can't be backed up?

iCloud won't help you if you're keen on backing up the following:
  • Apps, TV shows, music and books that have been removed from the Apple Store, iBookstore and the iTUnes store ever since you downloaded/purchased them
  • Media files that you've synced from your computer

An now, the steps involved in backing up iPhone data using iCloud service

How to Backup iPhone Data

Step 1: Go to your iPhone's Settings-> iCloud-> Storage & Backup
Now, under the 'Backup' tab, turn on the switch for the iCloud Backup.

Step 2: As per the second step, go back to the previous screen and turn on or off all the data that you want backed up from the displayed collection. Talking specifically about the apps, not all the iPhone apps appear here. Only the pre-installed Apple apps appear within this list.

Step 3: Scroll down to the Storage & Backup section and tap on it. Now, choose the “Manage Storage” section to reach a page where you'll be able to view the list of Apple apps and data that have been backed up.

Step 4: If you want to get to the apps, simply go the heading “Backups” followed by selecting and tapping on the device you want to manage. The next page would be the 'Info' page where under the heading 'Backup Options” you'll be able to view the list of top five storage-using apps. Here, you can choose the apps you want to back up. Toggle the apps that you don't want to back up to “Off”. With that you're done with backing up all all your crucial details that are stored within the iPhone. Although Apple gives you 5GB of iCloud storage for free, you may choose to back up more by paying an extra amount starting at $2- on a per year basis.

Wrapping Up

Timely backup of your iOS data to Cloud is essential because if you don't do it for 180 days or more, Apple reserves the right to delete all your previous iCloud backups on an immediate basis. So, get going and follow the aforementioned steps to backup your iPhone data using the easy-to-use and time-tested iCloud service.

About Author
Emily Heming is a savvy writer for Xicom Technologies from where you can opt iPhone Application Developers For Hire and you can also avail the reliable mobile application development services by contacting her.

Java Interview Questions

Here I am providing the most important java interview questions that are frequently asked in interviews. If you want to submit any core java or advance java interview questions or if you find any mistake in below questions than please notify us by the contact us page.


Java Interview Questions (Core Java and Advance Java)

Core Java Interview Questions

Q. Can we keep more than one class in a single java file?
A. Yes

Q. Can we keep main method in each class?
A. Yes

Q. Can we keep more than one main method in a single class?
A. Yes, with different prototype.

class A
{
                public static void main(String...s)
                {
                                System.out.println("Original main method");
                }

                public static void main(int s1)
                {
                                System.out.println("Duplicate main method");
                }
}

Q. Can we call main method explicitly?
A. Yes

class A
{
                public static void main(String...s)
                {
                                System.out.println("The Crazy Programmer");
                }
}

class B
{
                public static void main(String...s)
                {
                                A.main();
                }
}

Q. Can we execute our program without main method?
A. Yes, by using static block (supported till jdk 1.6).

class A
{
                static
                {
                                System.out.println("The Crazy Programmer");
                }
}

Q. Why character takes 2 bytes in java?
A. Because java support UNICODE, and for supporting UNICODE minimum 2 bytes are required.

Q. Is java purely or truly object oriented language?
A. No, because it supports primitive data types.

Q. Does constructor return any value?
A. Yes, it returns current object reference (this).

Q. Constructor is called before or after object creation?
A. It is called at the time of creation of object.

Q. Constructor is static or non-static?
A. 90% constructor is static by nature.

Q. Can constructor overloaded?
A. Yes, constructor is special method and method can be overloaded.

Q. What is the use of default constructor?
A. To initialize the default value.

Q. Inheritance occurs at compile time or run time?
A. At runtime, it can be proved by simply decompiling the .class file of child class.

Q. What super holds?
A. It holds reference id of parent section of child class object.

Q. What is first line of constructor, this or super?
A. By default first line of constructor is super. Both super and this can’t be used together.

Q. Why we use dynamic binding?
A. To achieve abstraction.

Q. Can we keep constructor in abstract class?
A. Yes, each class in java have constructor.

Q. Can we make abstract method static?
A. No, because static is accessed via class name and it will be accessed by anyone.

Q. Why we make interface methods by default public and abstract?
A. Because methods are implemented by end user.

Q. How multiple inheritance is implemented in java?
A. Multiple inheritance is implemented by interface.

interface my1
{
                . . . . .
                . . . . .
}

interface my2
{
                . . . . .
                . . . . .
}

interface my3 extends m1,m2
{
                . . . . .
                . . . . .
}

Q. What is difference between String and StringBuffer?
A. In String object is immutable (can’t be modified) while in StringBuffer object is mutable (can be modified).

Inheritance in Java

  • Creating a new class from existing class is known as inheritance.
  • Inheritance is used to achieve dynamic binding and reusability.
  • The class which is inherited is known as super class or parent class and the class derived from the parent class is known as sub class or child class.
  • Inheritance is implemented using extends keyword. Just take a look on below syntax.

class parent_class_name extends child_class_name
{
                //body
}              

  • All the properties of parent class come to child class if they are not private.
  • An example about how inheritance is implemented in java is given below.

class parent
{
                String name="Mark";
}

class child extends parent
{
                void show()
                {
                                System.out.println(name);
                }

                public static void main(String...s)
                {
                                child c=new child();
                                c.show();
                }

}


  • In above example variable name is default therefore it is accessible in child class. If we make name as private then it will show error like “name has private access in parent”.

Types of Inheritance in Java

  • There are three types of inheritance in java: single, multilevel and hierarchical inheritance.
  • In java, multiple inheritance is not supported by class. Multiple inheritance can be implemented by Interface, later on we will discuss about it.
Types of Inheritance in Java

Why multiple inheritance is not supported in java?

  • In order to decrease the complexity and ambiguity, multiple inheritance is not supported in java.
  • Consider a situation in which we have three classes A, B and C. Class C inherit class A and B. If classes A and B have a method with same prototype and when we call this method in class C then it will cause ambiguity because compiler will be confused that whether method from class A is called or method from class B is called.