Abstraction in Java is achieved using abstract methods in interfaces.
Interfaces are implemented by classes.
In this example, Sense is an interface.
The Sense interface contains an abstract method, named properties.
In the Sense interface, the properties method is an empty shell.
public String properties();
The classes See, Hear, Smell, Taste, and Touch, implement the Sense interface.
Those classes provide details for their specific Sense.
Many different types of living beings have the physical senses to see, hear, smell, taste, and touch.
Those senses are their windows into the universe.
But, what is the universe, really?
According to the CERN (“Conseil Européen pour la Recherche Nucléaire”) Standard Model,
the universe is space, matter particles and forces.
“All matter around us is made of elementary particles, the building blocks of matter.
These particles occur in two basic types called quarks and leptons.”
Quarks have been given interesting names… up, down, top, bottom, charm, and strange.
“Three of the fundamental forces [the “graviton” is not yet found] result from the exchange of
force-carrier particles, which belong to a broader group called ‘bosons’. ”
A special Boson, the Higgs Boson, is also known as the “God Particle”. The theory is, that the
Higgs Boson enables the other particles to have mass. In other words, to physically exist.
The CERN Standard Model and Yoga essentially agree about the substance of the physical universe.
The famous yogi, Paramahansa Yogananda, author of “Autobiography of a Yogi”, defined the universe
even further. He said that the elementary particles are made from “Lifetrons” and that the “Lifetrons”
come from “thoughtrons of the Infinite”.
Java NetBeans project Abstraction:
/*
abstract methods in interfaces
*/
interface Sense {
String awareness = “Awareness”;
public String properties();
}
/*
class implements interface
*/
class See implements Sense {
String see = “See”;
public String properties() {
return (Sense.awareness + “\r\n” + see + “\r\n” + “Eyes” + “\r\n” + “Photonreceptors” + “\r\n” + “Photons” + “\r\n” + “390 to 700 nanometers” + “\r\n” + “Thalamus”);
}
}
class Hear implements Sense {
String hear = “Hear”;
public String properties() {
return (Sense.awareness + “\r\n” + hear + “\r\n” + “Ears” + “\r\n” + “Mechanoreceptors” + “\r\n” + “Soundwaves” + “\r\n” + “20 Hz to 20 kHz” + “\r\n” + “Thalamus”);
}
}
class Smell implements Sense {
String smell = “Smell”;
public String properties() {
return (Sense.awareness + “\r\n” + smell + “\r\n” + “Nose” + “\r\n” + “Chemoreceptors” + “\r\n” + “Olfaction” + “\r\n” + “Olfactory Cortex” + “\r\n” + “Memory”);
}
}
class Taste implements Sense {
String taste = “Taste”;
public String properties() {
return (Sense.awareness + “\r\n” + taste + “\r\n” + “Tongue” + “\r\n” + “Chemoreceptors” + “\r\n” + “Taste Buds” + “\r\n” + “Sweet Sour Salt Bitter Umami” + “\r\n” + “Thalamus”);
}
}
class Touch implements Sense {
String touch = “Touch”;
public String properties() {
return (Sense.awareness + “\r\n” + touch + “\r\n” + “Skin” + “\r\n” + “Mechanoreceptors” + “\r\n” + “Sensory Neurons” + “\r\n” + “Thalamus”);
}
}