Download What Is Polymorphism In Java OOP? - Software Testing Tutorials graphic type that can be scaled to use with the Silhouette Cameo or Cricut. An SVG's size can be increased or decreased without a loss of quality. All of our downloads include an image, Silhouette file, and SVG file. It should be everything you need for your next project. Our SVG files can be used on adhesive vinyl, heat transfer and t-shirt vinyl, or any other cutting surface
StaticPolymorph.java
package oopbasics;
public class StaticPolymorph {
//Method 1
public int sum(int x, int y) {
return x + y;
}
//Method 2
public int sum(int x, int y, int z) {
return x + y + z;
}
//Method 3
public int sum(double x, int y) {
return (int) x + y;
}
//Method 4
public int sum(int x, double y) {
return x + (int) y;
}
}
ExcStaticPolymorph.java
package oopbasics;
public class ExcStaticPolymorph {
public static void main(String[] args) {
StaticPolymorph poly = new StaticPolymorph();
// Call Method 1
System.out.println(poly.sum(1, 7));
// Call Method 2
System.out.println(poly.sum(4, 2, 1));
// Call Method 3
System.out.println(poly.sum(2.5, 3));
// Call Method 4
System.out.println(poly.sum(4, 3.7));
}
}
Output :
8
7
5
7
Animal.java
package oopbasics;
public class Animal {
public void makeNoise() {
System.out.println("Some sound of animal.");
}
}
Dog.java
package oopbasics;
class Dog extends Animal {
public void makeNoise() {
System.out.println("Woof");
}
}
ExcAnimalAndDog.java
package oopbasics;
public class ExcAnimalAndDog {
public static void main(String[] args) {
Animal a1 = new Animal();
// Call makeNoise() from Animal class
a1.makeNoise();
Animal a2 = new Dog();
// Call makeNoise() from Dog class
a2.makeNoise();
}
}
Output :
Some sound of animal.
Woof
Download What Is Polymorphism In Java OOP? - Software Testing Tutorials All SVG file downloads also come bundled with DXF, PNG, and EPS file formats. All designs come with a small business commercial license. These SVG cut files are great for use with Silhouette Cameo or Cricut and other Machine Tools.