Hub Of Geekz

  • Home
  • About Me
  • Contact Us
  • Home
  • Languages
    • C++
    • Java
    • Perl
    • Prolog
    • Bootstrap
  • Database
    • SQL
    • PL/SQL
  • Study
    • Java
      • Java Collection
      • Java Concurrency
      • Java Interview Questions
      • Java Networking
    • Number System
  • Kavita
  • Entertainment
    • Hinglish Cafe
    • Videos
    • Jokes
  • Windows Tricks
  • How To

Tuesday, 30 September 2014

Inheritance in Java

 Unknown     11:38     Java     No comments   

package inheritance;


public class Class1 {

public static void printMessage()
{
System.out.println("I am in Class1 printMessage");
}
public void printMessage1()
{
System.out.println("I am in Class1 printMessage1");
}
}





package inheritance;


public class Class2 extends Class1 {

public static void printMessage()
{
System.out.println("I am in Class2 printMessage");
}
public void printMessage1()
{
System.out.println("I am in Class2 printMessage1");
}

}




package inheritance;


public class InheritanceLoadingVsRiding {

public static void main(String[] args) {


Class2 c2=new Class2();
Class1 c1=c2;
c1.printMessage();
c1.printMessage1();
c2.printMessage();
c2.printMessage1();

}

}




  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg
Email ThisBlogThis!Share to XShare to Facebook
Newer Post Older Post Home

0 comments:

Post a Comment

Ad


Jobsmag.inIndian Education BlogThingsGuide

Subscribe

Do you want fresh and hot updates about us? Then subscribe to our Feeds.

Total Pageviews

Popular Posts

  • Write a program in PL/SQL to print the factorial of a number.
    In this post I will explain how to get the factorial of any given number. For that first you need to know what is the procedure to find ...
  • To find the GCD of two numbers in PROLOG.
    gcd(X,Y):-X=Y,write('GCD of two numbers is '),write(X); X=0,write('GCD of two numbers is '),write(Y); Y=0,write('G...
  • Write a PL/SQL code to get the Fibonacci Sequence
    First, I will explain what is Fibonacci Sequence and how to get this series. So, Fibonacci Sequence is a series of numbers 0,1,1,2,3,5,8,1...

Label

All Articles Best Resources Blogging Boost Traffic Bootstrap C Plus Plus Collection Comedy Comedy Posts Comedy Videos Concurrency creative commons website Education Employee Entertainment Fibonacci Sequence free images GirlFriend Hinglish Cafe How To Image Websites Inspirational Java Java Interview Questions Java Networking Kavita Sangrah Life Lock Sreen Love Number System Patterns Perl Picture PL/SQL Plastic Engineering Programming Prolog public domain SEO Servlet Short Story Shortcut Keys Social Media Social Services SQL SuVichar Thread Traffic True Events Ultimate Guide Windows Tricks Windows8.1 WordPress

Blog Archive

  • ►  2020 (43)
    • ►  September (41)
    • ►  August (2)
  • ►  2019 (1)
    • ►  July (1)
  • ►  2018 (9)
    • ►  September (7)
    • ►  July (1)
    • ►  May (1)
  • ►  2017 (8)
    • ►  June (3)
    • ►  May (3)
    • ►  March (1)
    • ►  January (1)
  • ►  2016 (2)
    • ►  September (1)
    • ►  January (1)
  • ►  2015 (91)
    • ►  December (1)
    • ►  November (1)
    • ►  October (6)
    • ►  May (10)
    • ►  March (20)
    • ►  February (50)
    • ►  January (3)
  • ▼  2014 (339)
    • ►  December (1)
    • ►  October (55)
    • ▼  September (58)
      • ArrayList in Java
      • Exception Handling in Java
      • Exception handling in Java
      • Inheritance in Java
      • Exceptions in Java
      • Exception in Java
      • NegativeException in Java
      • NullPointer Exception in Java
      • ArrayIndexOutOfBoundException in java
      • Arithmetic Exception in Java
      • Exception Handling in java
      • Enumeration in Switch in Java
      • Advance Enumeration in java
      • Encapsulation in java
      • Basics of Encapsulation in java
      • String Manipulation in Java
      • Converting byte array to string
      • String methods in java
      • Different ways to concatenate a string in java
      • String Concatenation in java
      • Java Programming Questions
      • Various String Methods in java
      • Basics of Classes and Objects in java
      • Creating Array of Objects in java
      • कतरा कतरा बह के सब थम जायेगा
      • जीते जी हर पल मै मरता हु
      • सिसक कर आंसू क्यों आ जाते है
      • कुसूरवार हु मै तो सजा मुकम्मल करो मेरी गुनाह क़ुबू...
      • जज़्बात
      • दिल में है कुछ हलचल कहता है ये मुझसे हरपल
      • हम तो तन्हा ही जियेंगे अब तुम्हारे बिन शायद
      • हर बार अपनी कोशिशो में नाकाम हो जाते है  तुझको खो...
      • जो देखना चाहू तुमको मै तो ओझल हो जाते हो
      • मै टूट कर जिसके लिए रोया
      • क्यों तीर जैसे चुभते है तेरे हर शब्द मुझको
      • tujhme fnaa hoon
      • AUDIO SONG TUJHME FNAA HU
      • tujhme fnaa hoon
      • हाल ए दिल
      • हर गम से अनजान क्यों होता है ये दिल इतना नादाँन क...
      • कभी कभी बेकसूर होते हुए भी हम कुसूर वार बन जाते है...
      • जमाना कितना जालिम है हम इसकी हद को देखेंगे
      • मिल जाए मुझे भी कोई नीली छ्तरिवाला जिसके गले ...
      • बस और बस मै उसे देखता रहूँगा
      • हम डूबे हुए थे तेरी खातिर मझधार में फिर भी की आवाज...
      • हा दिल बेचैन है तुम बिन कही ना चैन है तुम बिन
      • वो तेरे सुर्ख लबो की कहानी याद आती है हा वो बीते ...
      • प्रभु मुझे इतना भोला बना दो  की मै भोले का दीवा...
      • यादे
      • जो रोलु चैन आता है मन हल्का हो जाता है मुस्कराहट...
      • ए मेरी सखी क्यों भई बावरीमै रहता हु हर पल तेरे स...
      • जो अलविदा कह दिया तो तुमसे बिछड़ जाऊंगा
      • तडपना कैसा होता है ये हम तुमको बतायेंगे
      • व्यंग्य
      • वो मेरे गुसुदगी की रपट लिखा आये
      • गमो में चूर करके तुम सीसे सा तोड़ करके तुम गये मु...
      • एक सवाल
      • सुविचार
    • ►  August (94)
    • ►  July (64)
    • ►  June (67)
  • ►  2013 (34)
    • ►  August (5)
    • ►  April (29)
  • ►  2012 (20)
    • ►  November (1)
    • ►  October (15)
    • ►  September (4)

Author

  • Earthcare Foundation NGO
  • Kavita house
  • Unknown
  • Unknown

Info

Copyright © Hub Of Geekz | Powered by Blogger
Design by Hardeep Asrani | Blogger Theme by NewBloggerThemes.com | Distributed By Gooyaabi Templates