Core Java Programming Challenges #15 | Coding Challenges | Naresh IT

preview_player
Показать описание
Core Java Programming Challenges #15 | Coding Challenges | Naresh IT

💡 Also Watch

Java Programming Tutorials by Mr.Hari krishna:
Advanced Java Programming Tutorials by Mr.Nataraj:

Subscribe to our channel and hit the bell 🔔🔔🔔 icon to get video updates.

💡 Visit Our Websites
#CoreJava_Programing #Challenges #CoreJava #Quiz
--------------------------

💡 About NareshIT:

"Naresh IT is having 14+ years of experience in software training industry and the best Software Training Institute for online training, classroom training, weekend training, corporate training of Hadoop, Salesforce, AWS, DevOps, Spark, Data Science, Python, Tableau, RPA , Java, C#.NET, ASP.NET, Oracle, Testing Tools, Silver light, Linq, SQL Server, Selenium, Android, iPhone, C Language, C++, PHP and Digital Marketing in USA, Hyderabad, Chennai and Vijayawada, Bangalore India which provides online training across all the locations

--------------------------

💡 Our Online Training Features:
🎈 Training with Real-Time Experts
🎈 Industry Specific Scenario’s
🎈 Flexible Timings
🎈 Soft Copy of Material
🎈 Share Videos of each and every session.

--------------------------

💡 Please write back to us at

--------------------------

💡 Check The Below Links

Рекомендации по теме
Комментарии
Автор

For example there are some codes written for 14 inch LCD TV then in the new generation a new 52 inch TV comes, so it wants the code written for same 14 inch TV technology with some upgradations.
In that case we use method overriding.

rohitkumargoud
Автор

public class methodoveride {
public void m()
{
int a=50, b=5;
int process = a+b;
Process: " +process);
}
}
public class methodoveride2 extends methodoveride{

public void m()
{
int a=8, b=7;
int process = a-b;
of a and b: " +process);
}
public static void main(String[] args) {
methodoveride2 m2 = new methodoveride2();
m2.m();


}

}

Output:
Substraction of a and b: 1

devrajsinghchouhan
Автор

/* The real life example of overriding is Atm machine...what ever the bank account u have..
every Atm machine will accept all the cards and performs the required operation irrespective of bank
here the card insert slot logic of one bank is overridden with another bank*/
package com.nit.challaenges;
class ATMHdfc{
void withDrawnMethod() {
System.out.println("amount withdrawniam frm ATMHdfc class ");
}
}
class Challenge_15 extends ATMHdfc{
void withDrawnMethod() {
System.out.println("amount withdrawn and iam frm Challenge_15 class ");
}
public static void main(String[] args) {
Challenge_15 ch=new Challenge_15();
ATMHdfc ac=new Challenge_15();
ATMHdfc ac1=new ATMHdfc();
ch.withDrawnMethod(); // it is executed from current object class(Challenge_15)
ac.withDrawnMethod();//it is executed from current object class(Challenge_15)
ac1.withDrawnMethod();//it is executed from current object class(ATMhdfc class)
}
}

chinthapallibalaji
Автор

Here car is upgraded from maruti 800 to maruti NEXA using overriding.

class ParentHome{
void ownerName(){
System.out.println("House Owner : Parent");
}
void car(){
System.out.println("Owner Car : Maruti 800");
}
}
class ChildHome extends ParentHome{
void car(){
System.out.println("Owner Car : Maruti NEXA");
}
public static void main(String[] args) {
ChildHome c = new ChildHome();
c.ownerName();
c.car();
}
}

iamnikhiljain
Автор

import java.util.*;
class Demo1{
void h(){

System.out.println("Cut the call");
}
}
class Demo extends Demo1{
void h(){

System.out.println("cut the call");
}

public static void main(String args[]) {
Demo d= new Demo();
d.h();
}
}

editorschoice
Автор

class Base
{
void functions ()
{
System.out.println("Calling ");
System.out.println("texting ");
System.out.println("alarms ");
System.out.println("Calender ");
System.out.println("Basic Games ");
}
}
class c15 extends Base
{
void functions ()
{
System.out.println("\nCalling ");
System.out.println("texting ");
System.out.println("alarms ");
System.out.println("Calender ");
System.out.println("Basic Games ");
System.out.println("Video Calls ");
System.out.println("Internet Surfing \n Adavanced gaming \n Multiprocessing ");
}


public static void main (String args[])
{
System.out.println("In main ()");
Base b= new Base();
b.functions();

c15 ob= new c15();
ob.functions();
}

}

pravinkhawse
Автор

package com.sreedhar;

class vehicle
{
int maxspeed=100;
int speed=40;
public void run()
{

System.out.println("Vehicle maxmimum speed"+maxspeed);
System.out.println("Vehicle runs with speed"+speed);

}

}
class Bike extends vehicle
{
int milage=50;
int speed=140;
public void run()
{
System.out.println("Vehicle runs with speed:"+speed);
System.out.println("Vehicle limit:"+milage);

}

}
class Challenge14b
{

public static void main(String[] args)
{

System.out.println("In main method");
Bike bk=new Bike();
bk.run();


}
}

sreedharkamera
Автор

package com.NIT;

//Method Overriding

public class Challenge15 {

public static void main(String[] args) {
SWE1 s = new SWE1();
SWE1 s1 = new SWE2();
s.display();
s1.display();

}

}

class SWE1{
protected int base = 20000;
public void display() {
System.out.println("SWE1 Salary: "+base);
}
}

class SWE2 extends SWE1
{
public void display() {
int basee = base;
basee=basee + (basee/5); //20% increment
System.out.println("SWE2 Salary: "+basee);
}
}

ksvijayan
join shbcf.ru