Best Example for Overriding vs. Overloading in Java

Overriding vs. Overloading


overloading-vs-overriding

Overriding and Overloading are two very important concepts in Java. They are confusing for Java novice programmers. This post illustrates their differences by using two simple examples.
1. Definitions
Overloading occurs when two or more methods in one class have the same method name but different parameters.
Overriding means having two methods with the same method name and parameters (i.e., method signature). One of the methods is in the parent class and the other is in the child class. Overriding allows a child class to provide a specific implementation of a method that is already provided its parent class.
2. Overriding vs. Overloading
Here are some important facts about Overriding and Overloading:
1). The real object type in the run-time, not the reference variable's type, determines which overridden method is used at runtime. In contrast, reference type determines which overloaded method will be used at compile time.
2). Polymorphism applies to overriding, not to overloading.
3). Overriding is a run-time concept while overloading is a compile-time concept.
3. An Example of Overriding
Here is an example of overriding. After reading the code, guess the output.
class Dog{
    public void bark(){
        System.out.println("woof ");
    }
}
class Hound extends Dog{
    public void sniff(){
        System.out.println("sniff ");
    }
 
    public void bark(){
        System.out.println("bowl");
    }
}
 
public class OverridingTest{
    public static void main(String [] args){
        Dog dog = new Hound();
        dog.bark();
    }
}
Output:
bowl
In the example above, the dog variable is declared to be a Dog. During compile time, the compiler checks if the Dog class has the bark() method. As long as the Dog class has the bark() method, the code compilers. At run-time, a Hound is created and assigned to dog. The JVM knows that dog is referring to the object of Hound, so it calls the bark() method of Hound. This is called Dynamic Polymorphism.
4. An Example of Overloading
class Dog{
    public void bark(){
        System.out.println("woof ");
    }
 
    //overloading method
    public void bark(int num){
     for(int i=0; i<num; i++)
      System.out.println("woof ");
    }
}
In this overloading example, the two bark method can be invoked by using different parameters. Compiler know they are different because they have different method signature (method name and method parameter list).

Note: Compile Time Error is better than Run Time Error. So, java compiler renders compiler time error if you declare the same method having same parameters.

Can we overload java main() method?

Yes, by method overloading. You can have any number of main methods in a class by method overloading. But JVM calls main() method which receives string array as arguments only. Let's see the simple example:
  1. class TestOverloading4{  
  2. public static void main(String[] args){System.out.println("main with String[]");}  
  3. public static void main(String args){System.out.println("main with String");}  
  4. public static void main(){System.out.println("main without args");}  
  5. }  

Good evening

HAI EVERY ONE HOW ARE  YOU ALL.

SORRY FOR NOT UPDATING THE BLOG. I WILL TRY TO UPDATE SINCE TODAY ONWARDS VARIOUS ARTICLES.

Generations of Cellular Network Technologies

4G, LTE, VOLTE, EVDO, GPRS, 2G, 3G, HSPA, EDGE EXPLAINED: MOBILE INTERNET STANDARDS DECODED

We usually come across these network standard terms as 3G4GWiMAXLTEVoLTEEDGE, GPRS, EvDO, RTT, etc. on the specifications sheet of various gadgets supporting wireless internet. While geeks understand the meaning of these cellular/mobile network technologies, the normal people simply just take them for what the retailers tell them about it.
Your trusted retailer might be right for most of the times, but he has a business to run. So, might try to sell you gadgets with outdated wireless connectivity sometime or the other. That’s why it is very important that you understand what these technologies offer you in terms of speed and connectivity. We don’t want to get too deep into the technicalities or you will just get bored with the technical jargon.
mobile internet standards 2G 3G 4G EDGE EvDO GPRS RTT HSPA HSPA+ LTE WiMAX LTE-A
This article will explain the meaning and the significance of these standards in a very simple language.

GENERATIONS OF CELLULAR NETWORK TECHNOLOGIES

You know that each successor to the mobile network technology has one numeric number followed by the alphabet ‘G’. This is of the form ‘xG’. So, 2G means 2nd generation, 3G means 3rd generation, 4G means 4thgeneration and so on. Each generation is more advanced than the previous standard. Which is but obvious, isn’t it?
Currently, 4G is the latest standard but many big organizations have already started their work on the upcoming 5G wireless technology.

GSM NETWORK VS. CDMA NETWORK

GSM and CDMA (Code Division Multiple Access) are the two most popular radio standards used in the mobile world. Both technologies offer similar features but CDMA is more popular in the U.S. than the rest of the world. Most of the European and Asian countries use GSM networks. Some might tell you CDMA is better than the GSM or vice-versa but it is not exactly true.
The U.S. operators moved to the CDMA technology when GSM technology was in a nascent stage but now that GSM technology has caught up with CDMA, the U.S. operators don’t feel the need to shift to GSM technologies. Most of the telecom companies in the rest of the world utilize the GSM technology for rolling out their networks, and they also don’t feel the need to migrate to CDMA technology.
So, when you go out in the market for buying a new phone, you will see that the available GSM phone models are much more in number than the CDMA models.You know the reason behind this.
Now, let’s discuss each generation of network in detail along with its associated network standards:

2G

2G is the first digital mobile network technology. 1G was analog technology and was very inefficient. 2G brought support for SMS and mobile internet.
GSM (Global System for Mobile communication) uses GPRS (General Packet Radio Service) and EDGE (Enhanced Data rates for GSM Evolution) technology for internet access, while the CDMA technology uses RTT (Radio Transmission Technology) for providing 2G internet access.

3G

It is the first mobile network technology to provide access to high-speed broadband like internet. Live video streaming, video chatting were first made possible by the 3G network technologies.
GSM networks use WCDMA (Wideband Code Division Multiple Access) or UMTS (Universal Mobile Telecommunications Service), HSPA (High Speed Packet Access), and HSPA+ technologies for rolling out 3G networks. The CDMA networks on the other hand, use EvDO (Evolution-Data Optimized) technology for deploying 3G networks.

4G

It is the latest generation of mobile wireless technology and offers the best data speed. It is made for providing mobile broadband access and can be used for data intensive applications like watching high-definition TV on mobile, cloud computing etc.
4G network is currently deployed using LTE (Long Term Evolution) and WiMAX (Worldwide Interoperability for Microwave Access) technologies. As per the ITU-R (International Telecommunication Union-Radio Communication Sector), any network having a peak download rate of 100 Mbps for high mobility and up to 1 Gbps for stationary wireless access will be termed as a 4G network.
LTE, LTE-A (LTE Advanced), WiMAX Rel 1, and WiMAX Rel 2 are some of the popular 4G network standards.

WHAT’S VOLTE?

VoLTE is short for Voice-over-LTE and allows the 4G network (based on packet switching) to convert voice into packets. These packets are then transmitted over the network and converted back into voice at the other hand. Also due to the fact that an LTE network has higher bandwidth than the traditional 2G and 3G networks, the voice calls made over LTE (using VoLTE) tend to be a lot more clearer and crisper. This VoLTE calling is also marketed as “HD Voice“.
4G networks are based on neither GSM nor CDMA technology, but are instead based on OFDMASC-FDMAtechnologies. That’s why the basic 4G networks can’t make voice calls and a new standard called VoLTE is being deployed to make that possible.
The following table lists down the speed ratings of each of these network technologies.
GenerationStandard RadioMaximum Theoretical Download SpeedMaximum Theoretical Upload Speed
2GGPRSGSMUp to 80 Kbps (Class 10)Up to 20 Kbps
2GEDGEGSMUp to 236.8 KbpsUp to 59.2 Kbps
2G1xRTTCDMAUp to 0.3 MbpsUp to 0.15 Mbps
3GUMTS (WCDMA)GSMUp to 384 KbpsUp to 384 Kbps
3GHSPAGSMUpto 14.4 MbpsUp to 5.76 Mbps
3GHSPA+GSMUpto 42 MbpsUp to 11.5 Mbps
3GEvDO Rev. ACDMAUp to 3.1 MbpsUp to 1.8 Mbps
3GEvDO Rev. BCDMAUp to 4.9xN MbpsN: number 1.25 MHz carriersUp to 1.8xN Mbps
4GLTEOFDMAUp to 100 Mbps (Cat3)Up to 50 Mbps (Cat4)
4GLTE-AOFDMA, SC-FDMAUp to 1 GbpsUp to 500 Mbps
4GWiMAX Rel. 1OFDMAUp to 30-40 MbpsUp to 17 Mbps
4GWiMAX Rel. 2OFDMAUp to 1 GbpsUp to 376 Mbps

All of the above mentioned speeds are theoretical values derived for different standards for ideal scenarios. Nothing is ideal in real world. Furthermore connection throttling by the operator, network congestion, and quality of service also affect the actual speed that the user gets.
‘B’ IS NOT THE SAME AS ‘B’
This is one of the most common mistakes made by non-technical people while mentioning the speed of their internet connection.
For network configurations, ‘B’ is known as byte and ‘b’ is known as bit.
1 byte (B) = 8 bits (b)
ISPs (Internet Service Providers) and modem manufacturers specify the speed in bps (bits/second), whereas the internet download managers and other file sharing programs denote the speed in Bps (bytes/sec).
For S.I. system:
1 Mega = 1,000,000
But for Windows computer system (binary):
1 mega = 2^20= 1,048,576.
That’s why:
A download speed of 1 Mbps = 1024 Kbps = (1024/8) KBps = 128 KBps
Now, that you know what to expect from each network technology, there is one more thing that should be kept in mind while selecting a phone for international roaming. Different frequency bands are used for deploying these mobile networks across different parts of the world. So, a 4G phone launched for the U.S. market might not be able to latch onto Indian 4G networks.
That’s why it is always wise to take a look at the frequencies supported by the phone and your network operator before making a buying decision.

TechNews

SAMSUNG GALAXY A8(2018) PLUS IMAGES LEAK 

Samsung Galaxy A series of smartphone for 2018 have been doing the rounds of social networks for a while now. Back in November, we spotted the 2018 Galaxy A5 bearing the model number A530N listed by the FCC. New reports now reveal images of what is rumoured to be the Samsung Galaxy A8 Plus.
Samsung Galaxy A8 Plus. Image: Weibo
Samsung Galaxy A8 Plus. Image: Weibo
As per a report by Android Headlines, two real images of the Galaxy A8 Plus were shared by an unknown user on Chinese social media website, Weibo. As per the report, the smartphone revealed in the images is likely the official successor to the Samsung Galaxy A7 (2017). While the reason behind Samsung's minor rebranding is unknown, the images give us a good look at the expected design of the smartphone.
The first of the two images gives us a clear look at the top of the smartphone which shows the use of Samsung's Infinity display panel. The bezel-less design revealed here reminds us of the Samsung Galaxy S8, though the edges here do not wrap around the display. The report also tells us that the aspect ratio of the screen could be 18.5:9. The second image, on the other hand, gives users a clearer look at the model number which reads SM-A730F.
Samsung Galaxy A8 Plus. Image: Weibo
Samsung Galaxy A8 Plus. Image: Weibo
Apart from the display, the first image also reveals what looks like a dual-selfie camera setup which is also vaguely noticeable in the second image.
Samsung is yet to mention anything about its mid-range smartphone line up for 2018. The Galaxy A7 is currently the top variant of the Galaxy A series.
Samsung's upcoming flagship phones will make their debut this February, most likely at MWC 2018 (Mobile World Congress) in Barcelona, Spain.

Leaked Samsung Galaxy S9 schematics. Slashleaks
Leaked Samsung Galaxy S9 schematics. Slashleaks
According to a Bloomberg report, the upcoming devices will be teased in "late February" and will go on sale in "early March". The devices, expected to be the Samsung Galaxy S9 and S9 Plus, are going to be very similar to last year's S8 and S8 Plus (review). The major difference will be the upgraded camera hardware, say Bloomberg's sources.
This report flies in the face of expectations of a CES 2018 debut and an MWC 2018 launch.
In 2017, the launch of Samsung's flagship smartphones was delayed considerably owing to the difficulty in manufacturing enough Qualcomm Snapdragon 835 chips. These chips are what powered most of the Android flagships in 2017.
A side effect of the production issues was that MWC 2017 was rather lacklustre, given that many of the smartphone manufacturers had to push their premium device launches by a few months. It's not clear if the upcoming Snapdragon 845 chips will also be delayed in 2018.
Various leaks do suggest that the new phones will come with a single-camera setup at the rear, as opposed to the dual-camera one seen on the Galaxy Note 8 (review). It's possible that the upcoming phones will use Qualcomm's and Google's single-camera portrait mode support to deliver a better quality single camera experience.
An earlier report also hinted at at an in-display fingerprint sensor on the front. However, Bloomberg's report hinting at a more traditional design and a Slashleaks report of a rear-mounted fingerprint sensor say otherwise.

Swamy Vivekananda

Strength is Life,Weakness is Death

                                                 

                                    SWAMI VIVEKANANDA

Date of Birth:  January 12 , 1863 
Place of Birth: Calcutta, Bengal Presidency (Now Kolkata in West Bengal)
Parents: Vishwanath Dutta (Father) and Bhuvaneshwari Devi (Mother)
Education: Calcutta Metropolitan School; Presidency College, Calcutta
Institutions: Ramakrishna Math; Ramakrishna Mission; Vedanta Society of New York
Religious Views: Hinduism
Philosophy: Advaita Vedanta
Publications: Karma Yoga (1896); Raja Yoga (1896); Lectures from Colombo to Almora (1897); My Master (1901)
Death: July 4, 1902
Place of Death: Belur Math, Belur, Bengal
Memorial: Belur Math, Belur, West Bengal

SWAMI VIVEKANANDA'S inspiring personality was well known both in India and in America during the last decade of the nineteenth century and the first decade of the twentieth. The unknown monk of India suddenly leapt into fame at the Parliament of Religions held in Chicago in 1893, at which he represented Hinduism. His vast knowledge of Eastern and Western culture as well as his deep spiritual insight, fervid eloquence, brilliant conversation, broad human sympathy, colourful personality, and handsome figure made an irresistible appeal to the many types of Americans who came in contact with him. People who saw or heard Vivekananda even once still cherish his memory after a lapse of more than half a century.
In America Vivekananda's mission was the interpretation of India's spiritual culture, especially in its Vedantic setting. He also tried to enrich the religious consciousness of the Americans through the rational and humanistic teachings of the Vedanta philosophy. In America he became India's spiritual ambassador and pleaded eloquently for better understanding between India and the New World in order to create a healthy synthesis of East and West, of religion and science.
In his own motherland Vivekananda is regarded as the patriot saint of modern India and an inspirer of her dormant national consciousness, To the Hindus he preached the ideal of a strength-giving and man-making religion. Service to man as the visible manifestation of the Godhead was the special form of worship he advocated for the Indians, devoted as they were to the rituals and myths of their ancient faith. Many political leaders of India have publicly acknowledged their indebtedness to Swami Vivekananda.
The Swami's mission was both national and international. A lover of mankind, he strove to promote peace and human brotherhood on the spiritual foundation of the Vedantic Oneness of existence. A mystic of the highest order, Vivekananda had a direct and intuitive experience of Reality. He derived his ideas from that unfailing source of wisdom and often presented them in the soulstirring language of poetry.
The natural tendency of Vivekananda's mind, like that of his Master, Ramakrishna, was to soar above the world and forget itself in contemplation of the Absolute. But another part of his personality bled at the sight of human suffering in East and West alike. It might appear that his mind seldom found a point of rest in its oscillation between contemplation of God and service to man. Be that as it may, he chose, in obedience to a higher call, service to man as his mission on earth; and this choice has endeared him to people in the West, Americans in particular.
In the course of a short life of thirty-nine years (1863-1902), of which only ten were devoted to public activities-and those, too, in the midst of acute physical suffering-he left for posterity his four classics: Jnana-Yoga, Bhakti-Yoga, Karma-Yoga, and Raja-Yoga, all of which are outstanding treatises on Hindu philosophy. In addition, he delivered innumerable lectures, wrote inspired letters in his own hand to his many friends and disciples, composed numerous poems, and acted as spiritual guide to the many seekers, who came to him for instruction. He also organized the Ramakrishna Order of monks, which is the most outstanding religious organization of modern India. It is devoted to the propagation of the Hindu spiritual culture not only in the Swami's native land, but also in America and in other parts of the world.
Swami Vivekananda once spoke of himself as a "condensed India." His life and teachings are of inestimable value to the West for an understanding of the mind of Asia. William James, the Harvard philosopher, called the Swami the "paragon of Vedantists." Max Muller and Paul Deussen, the famous Orientalists of the nineteenth century, held him in genuine respect and affection. "His words," writes Romain Rolland, "are great music, phrases in the style of Beethoven, stirring rhythms like the march of Handel choruses. I cannot touch these sayings of his, scattered as they are through the pages of books, at thirty years' distance, without receiving a thrill through my body like an electric shock. And what shocks, what transports, must have been produced when in burning words they issued from the lips of the hero!''

Image result for Swamy Vivekananda

Image result for Swamy Vivekananda

Image result for Swamy Vivekananda
HAPPY FATHERS DAY

Never forgot your parents because they are only the one who think about you in the world in all the situations good about you. No one can show love and affection as your mother and father because it is only the genuine love in the world shown by them. Respect elders.

Don't Quit

When things go wrong as they sometimes will,
When the road you're trudging seems all up hill,
When the funds are low and the debts are high
And you want to smile, but you have to sigh,
When care is pressing you down a bit,
Rest if you must, but don't you quit.
Life is queer with its twists and turns,
As every one of us sometimes learns,
And many a failure turns about
When he might have won had he stuck it out;
Don't give up though the pace seems slow--
You may succeed with another blow,
Success is failure turned inside out--
The silver tint of the clouds of doubt,
And you never can tell how close you are,
It may be near when it seems so far;
So stick to the fight when you're hardest hit--
It's when things seem worst that you must not quit.

- Edgar A. Guest 

Types of Fire Extinguishers

Types of Fire Extinguishers

Water and foam extinguishers

Water and Foam

Water and Foam fire extinguishers extinguish the fire by taking away the heat element of the fire triangle. Foam agents also separate the oxygen element from the other elements.
Water extinguishers are for Class A fires only - they should not be used on Class B or C fires. The discharge stream could spread the flammable liquid in a Class B fire or could create a shock hazard on a Class C fire.

Carbon Dioxide extinguishers

Carbon Dioxide

Carbon Dioxide fire extinguishers extinguish fire by taking away the oxygen element of the fire triangle and also be removing the heat with a very cold discharge.
Carbon dioxide can be used on Class B & C fires. They are usually ineffective on Class A fires.
Dry Chemical extinguishers

Dry Chemical

Dry Chemical fire extinguishers extinguish the fire primarily by interrupting the chemical reaction of the fire triangle.
Today's most widely used type of fire extinguisher is the multipurpose dry chemical that is effective on Class A, B, and C fires. This agent also works by creating a barrier between the oxygen element and the fuel element on Class A fires.
Ordinary dry chemical is for Class B & C fires only. It is important to use the correct extinguisher for the type of fuel! Using the incorrect agent can allow the fire to re-ignite after apparently being extinguished succesfully.
Wet Chemical extinguishers

Wet Chemical

Wet Chemical is a new agent that extinguishes the fire by removing the heat of the fire triangle and prevents re-ignition by creating a barrier between the oxygen and fuel elements.
Wet chemical of Class K extinguishers were developed for modern, high efficiency deep fat fryers in commercial cooking operations. Some may also be used on Class A fires in commercial kitchens.
Clean Agent extinguishers

Clean Agent

Halogenated or Clean Agent extinguishers include the halon agents as well as the newer and less ozone depleting halocarbon agents. They extinguish the fire by interrupting the chemical reaction of the fire triangle.
Clean agent extinguishers are primarily for Class B & C fires. Some larger clean agent extinguishers can be used on Class A, B, and C fires.
Dry Powder extinguishers

Dry Powder

Dry Powder extinguishers are similar to dry chemical except that they extinguish the fire by separating the fuel from the oxygen element or by removing the heat element of the fire triangle.
However, dry powder extinguishers are for Class D or combustible metal fires, only. They are ineffective on all other classes of fires.
Water Mist extinguishers

Water Mist

Water Mist extinguishers are a recent development that extinguish the fire by taking away the heat element of the fire triangle. They are an alternative to the clean agent extinguishers where contamination is a concern.
Water mist extinguishers are primarily for Class A fires, although they are safe for use on Class C fires as well.
Cartridge-Operated Dry Chemical extinguishers

Cartridge Operated Dry Chemical

Cartridge Operated Dry Chemical fire extinguishers extinguish the fire primarily by interrupting the chemical reaction of the fire triangle.
Like the stored pressure dry chemical extinguishers, the multipurpose dry chemical is effective on Class A, B, and C fires. This agent also works by creating a barrier between the oxygen element and the fuel element on Class A fires.
Ordinary dry chemical is for Class B & C fires only. It is important to use the correct extinguisher for the type of fuel! Using the incorrect agent can allow the fire to re-ignite after apparently being extinguished successfully.