Category: Java

java documentation

Introduction to ruby

Ruby is not the universal panacea for programmers’ problems. There will always be times when you’ll need a particular language: the environment may dictate it, you may have special libraries you need, performance concerns, or simply an issue with training. We haven’t given up languages such as Java and C++ entirely (although there are times […]

Method Overriding code Sample

class IBM{ public void employee(){ int empId=101; String name=”joash”; } class Wellsfargo extends IBM{ // this is method Overriding we are using IMB method to achive our goal public void empHike(int sal){ } public class MethodOverridingsEx { }

Method overloading using Logging Example code

public class LoggingEx { public void loggin(int id){ System.out.println(“you got to enter password , please enter it”); }

Java Enterprise Bean Example

import; public class Employee implements Serializable { private int id; private String name; private String city; } Testing the Bean Class public class Test { // getting the set name from the employee object }

java interface code Sample

interface Animal{ public abstract void walk(); } interface Bird{ public abstract void fly(); } class Test implements Animal,Bird { public void walk(){ System.out.println(“the animal is walking”); } public void fly(){ System.out.println(“it never fly”); } } public class InterfaceExample { }

Really World Java Interface Example Code

interface MakeMyTrip{ public abstract int getAvailability(); public abstract void proceedBooking(); } class UkAirline implements MakeMyTrip{ } class ArabEmirates implements MakeMyTrip{ public int getAvailability(){ int availability=0; return availability; } public void proceedBooking(){ if(getAvailability()>1){ System.out.println(“you have successfully booked”); } else { System.out.println(“Sorry no available flyight for Arab Emirates”); } } } public class InterfaceEx { }

Single Inheritance Example Code

class A{ public int addition(){ int i=10; int j=20; int Result =i+j; System.out.println(“The additin is “+ Result); return Result; } public int subtraction(){ int i=10; int j=20; int Result =i-j; System.out.println(“The additin is “+ Result); return Result; } } class B extends A{ } public class SingleInheritanceEx { }

Java Multilevel inheritance code Example

class Anonymous{ public void basicData(){ System.out.println(“Vehicle is munufactured in USA “); System.out.println(“vehicle is available in all location”); } } class SpecialOfficer extends Anonymous{ public void moreData(){ System.out.println(“Vehicle is purchased buy Joash “); System.out.println(“vehicle is haveng permision thout USA”); } } class Owner extends SpecialOfficer{ public void fullData(){ System.out.println(“vehicle vin number is XCXZSAD43”); System.out.println(“Vehicle registered under […]

Java inheritance code Example

class FederalBa{ public int getROI(){ int ROI=3; return ROI; } class Wellsfargo extends FederalBa { public void WFROI(){ int WFROI=getROI()+1; System.out.println(“Welsfargo ROI is “+ WFROI); } } class JPMorgan extends FederalBa { public void JPROI(){ int JPROI=getROI()+2; System.out.println(“Welsfargo ROI is “+ JPROI); } } public class FederalBank { }


Enjoy this blog? Please spread the word :)

Follow by Email