Difference between Method Overloading and Method Overriding
Method Overloading and Overriding help us to achieve polymorphism, which is one of the features of Object-Oriented-programming language
1. Method Overloading
- Method overloading is a oops concepts in which a class can have two or more methods with same name but with different parameter
- It is also called static polymorphism or time binding or early binding
- It is implemented during compile time
- There are two ways to overload method in java :
1.Different Number of Arguments
2.Different Data Types
Example
public class MethodOverloading
{
public static void main(String[] args)
{
MethodOverloading a = new MethodOverloading ();
a.age(5);
a.age(18, "CSE");
a.display('H');
a.display(12);
}
public void age(int a)
{
System.out.println("The age is:" + a);
}
public void age(int a, String c)
{
System.out.println("The age is:" + a +" Name:" + c);
}
public void display(int a)
{
System.out.println("The age is:" + a);
}
public void display(char a)
{
System.out.println("Name is:" + a);
}
}
2. Method Overriding
- if sub class has the same method as declared in parent class it is called method overriding
- it is also called dynamic binding/ dynamic polymorphism
- It is implemented during run time
Example
class baby
{
void display()
{
System.out.println("This is the Child class");
}
}
public class MethodOverriding extends baby
{
public static void main(String[] args)
{
MethodOverriding obj = new MethodOverriding ();
obj.display();
}
void display()
{
super.display();
System.out.println("This is the parent class");
}
}
Importance of Digital Proficiency
The modern world is to be proficient in digital world. The invention of computer by Charles Babbage and the development of internet by ARPANET is a milestone in the process of digitalization of the modern world (Schafer, 2019). Digital technology is a recent long wave of socio-economic evolution that has transformed every aspect of human life. With such advent of technologies, it has become mandatory to master it. Therefore, being digitally proficient is the way of living in this modern world. It is an idea to create awareness for the good of humanity, for prospering business and to retain information for explorations in various fields.
To the grass root level, being digitally proficient helps in the conduct of campaigns to the targeted number of people. As an elevated method to create awareness, it provides a platform to give voice to voiceless. For an instance the Danish branch of the World Wildlife Federation (WWF) developed a campaign leveraging the short-lived nature of snapshot posts to help protect endangered species. Snap chat users were accustomed to their selfies disappearing within seconds of posting. To convey their message the authorities alerted about the vulnerability of endangered species by sharing dramatic, close up photos of animals on the verge of extinction with the message: “Don’t let this be my last selfie.” The WWF authorities asked the users to share the post and make some donation. The act was digitally a simple procedure but the result was large where 5000 people had shared the post within hours on twitter and by the end of the week, more than 120 million had seen the message. Moreover, within three days, the charity reached its fundraising goal for the entire month. (“Last Selfie,”2014). This shows that digitally equipped can give voice to voiceless and privileges to underprivileged ones. Furthermore, it also helps in marketing of individual business to successful level.
The literacy in digital technologies serves to connect businessman and the consumer by effective communication and digital platforms. For a consumer to purchase goods it is must that the details of the product should be known by the consumers. However, to fill that gap the businessman with the help of technologies must convey the features of the product by publicizing its brand or ideology. In Bhutan, Zala company gained over 150,000 views and many comments to buy the product. Furthermore, the term online shopping has become a trend in today’s era where the products to be sold are displayed through websites describing the products prices and its feature. Ultimately the method is found to be a success and made huge profit. Such is the power of being digitally literate. On next level digital proficiency can be used to retain information for scientific explorations.
On an advanced level of being digitalized, engineers all over the world had used the retained information to explore the universe. One such incident can be noted from the work of Katherine Johnson who is a NASA employee and was credited the success of the first and subsequent U.S crewed spaceflights. (Loff, 2016). It was all because of the algorithms which calculated the trajectories, launch windows and significantly more. Furthermore, the image of black hole; less apparently clear though, which was once thought impossible to capture is being captured by Katie Bouman and it was possible because of the computer program developed by Katie. At present the data they captured has been stored on hundreds of hard drives to central processing centers in Boston, US and Bonn, Germany for the creation of striking image. (Bouman,2019).
To conclude, an easy way to educate yourself is by being proficient in digital world through which one convey the ideas through various digital campaign. Furthermore, on next level of upgrading oneself financially, online business could be implemented if one has a good knowledge on information technology. To be unaware about the digital technologies will subsequently have a negative impact and would remain backward compared to others. Therefore, to help oneself and promote one must be having a good knowledge about the technologies around as significantly explained above.
Pattern-21
Pattern21
Digital Technology
Digital technology is changing every aspect of the world. Digital technologies includes social media, online games, multimedia and mobile phones and any technology that stores and process data. Digital technologies have revolutionized the way people think or the way they live their everyday lives without even realizing it. Digital technology has changed education, given people broader access to information, changed the way people maintain contact which will all be for naught if people don’t keep up with the constantly changing digital world.
Due to most people using phones, technology has slowly become integrated into schools and serves as a link between home and school. Using technologies in education has enabled students to learn things that interest them from different resources. This is known as digital learning. It is stated that over 90% of young people are online and have cell phones, over half of adults aged 65 and above are online and 78% own a cell phone (Anderson, 2015).It has become valuable as it is readily accessible and it is visual based learning there by making children learn more easily than non-visual means. For example, watching videos and playing games enable people to learn about different cultures and language. They watch videos and listen to people speaking from different parts of the world and enable them to learn about their everyday lives.
Furthermore, technology has revolutionized the way people keep in contact from letter writing to cell phones, video calls, and social media. It has also changed the way individuals participate in social, cultural and political activities as all sorts of information these days is first uploaded to the internet and then shared to social media sites where people participate in discussions and debates. Social media has destroyed the barriers that separate the people of this world by making it easier to communicate with each other and making information easily accessible anytime and anywhere to anyone who wants it. Using social networks can shorten the time. All sorts of services can be availed through the internet without leaving the comfort of your home. Digital technologies are being improved and developed gradually to match the needs of the people but if people aren’t proficient in using these technologies then it can lead to lots of problem.
Due to the present situation of covid-19, remote working has been advised which meant that people needed to know the skills to navigate through social media, in mobile phones and computers. Times like these has made us learn the importance of digital literacy. Even though digital learning had become quite popular only some children and young people have access to knowledgeable adults and technological resources that can help improve their learning and creativity. This is because most aren’t knowledgeable about digital technology and they do not find it necessary to give their children access to broadband internet or let them learn skills in computers. People need to be educated in digital technology to a certain level to understand and to be aware what happens on the internet. Digital literacy keeps you more connected as you learn not only how to create content using information, you can also share what you know or heard or watch to people who are interested in the same things as you. Digital literacy is very important to know what information on the internet is fake so that you don’t get scammed and to find out what is a good source of information. Digital literacy is lifelong learning that one should never forego.
To conclude, people should understand that technologies will continue to become embedded in the daily lives of every human being and the physical infrastructure of their homes. Digital technologies have transformed how people communicate, learn and live their lives.Our life got to be more helpful since social media may be an exceptionally valuable apparatus in 21st century, it might offer assistance to improve our life. But people must be mindful of how to utilize it.
Determinant of a 3X3 matrix
Determinant of a 3X3 matrix
Add two 3X3 matrix
Add two 3X3 matrix
print numbers in Descending order
printing Numbers in descending order
Print numbers in ascending order
Print numbers in ascending order
Maximum and minimun in an array
Maximum and minimun in an array
Display array in reverse order
Array in reverse order
Programs using Recursive Function
Recursive Function is a functtion which calls itself.Every recursive function must have a base condition to stop the function else the program will never end
Advantage of Recurive Function
1.it makes the coding clean
2.it helps solve a complex problem by breaking it down into many parts
Question: Write a program to find the sum of a number from 1 to n using recursive function
Solution:
import java.util.Scanner;
public class Recursive1
{
static int sum=0;
public static void main(String[] args)
{
Scanner s = new Scanner(System.in);
System.out.print("Enter A number:");
int n = s.nextInt();
System.out.print("The sum of the numbers from 1 to " + n +" is " + sum(n));
}
public static int sum(int n)
{
int i=n;
if(i!= 0)
{
sum = sum + i;
i--;
return sum(i);
}
return(sum);
}
}
Output:
Question: Write a program to find the factorial of a given number using recursive function
Solution:
import java.util.Scanner;
public class Recursive2
{
static int fac=1;
public static void main(String[] args)
{
Scanner s = new Scanner(System.in);
System.out.print("Enter A number:");
int n = s.nextInt();
System.out.print("The factorial of the number is " + n +" is " + fac(n));
}
public static int fac(int n)
{
int i=n;
if(i!= 0)
{
fac = fac * i;
i--;
return fac(i);
}
return(fac);
}
}
output:
Question:Write a program to print multiplication table of any number from 1 to 12 using recursive function
Solution:
import java.util.Scanner;
public class Recursive3
{
static int i=1;
public static void main(String[] args)
{
Scanner s = new Scanner(System.in);
System.out.print("Enter A number:");
int n = s.nextInt();
System.out.print("The Multiplication table of " + n +" from 1 to 12 is \n");
mut(n);
}
public static int mut(int n)
{
if(i<=12)
{
System.out.println(i +"*"+ n+ " : " + (i*n));
i++;
fac(n);
}
return(n);
}
}
output:
Question: Write a program to find the prime number using recursive program
Solution
import java.util.Scanner;
public class Recursive4
{
static int count=0;
static int i=1;
public static void main(String[] args)
{
Scanner s = new Scanner(System.in);
System.out.print("Enter a number:");
int n = s.nextInt();
System.out.print("The given number "+ n +" ");
check(n);
if(count==2)
System.out.print("is prime");
else
System.out.print("is not prime");
}
public static int check(int n)
{
if(i<=n)
{
if(n%i==0)
{
count++;
}
i++;
return check(n);
}
return count;
}
}
Output:
Question: Write a program to find the cube of a given number
Solution:
import java.util.Scanner;
public class Recursive5
{
static int i =1;
static int p =1;
public static void main(String[] args)
{
Scanner s = new Scanner(System.in);
System.out.print("Enter a number:");
int n = s.nextInt();
System.out.print("The cube of " + n+ " is " + cal(n));
}
public static int cal(int n)
{
if(i&jlt;=3)
{
p=p*n;
i++;
return cal(n);
}
return p;
}
}
output:
Check whether a number is a Palindrome Number
Palindrome Number
Check whether a number is a Prime Number
Prime Number
Printing Fibonacci Series
Printing Fibonacci Series
Reverse a number
Reverse a number
Multiplication Table of any number till 12
Multiplication Table of any number till 12
Calculating sum of numbers from 1 to n
Calculating sum of numbers from 1 to n