The process of imposing type constraints at compile-time and discard the element type information at runtime.
In the other words, the compiler replaces a generic parameter with the actual class or bridge method. moreover, the compiler ensures that no extra classes are created and there is no runtime overhead.
In fact, type erasure ensures your code to be compatible with older versions of java which may not contain generics at all.
Flowers flower = sample.emptyBucket();
the compiler will turn the above code in a casted way.
Flowers flower = (Object) sample.emptyBucket();
Lambda expressions and Functional programming are considered as the cornerstones of the Java 8 .
what is a Lambda Expression?
simply a block of logic that get passed around , like an anonymous method.
What is a Functional Interface?
simply a functional interface is an interface with a single abstract method.
Functional interfaces are used as the basis of the lambda expression and that is how functional interface technically related to the lambda expressions.
How compiler works on making Functional Interfaces
Java compiler is smart enough to take any interface with a single abstract method as a functional interface.
I thought of dating machine learning for my personal interest. As a beginner, I would recommend you to start with Data Preprocessing. In this article, I am going to make you familiar with the Data preprocessing tools.
Let’s give this a go…
For the past few days, I have been getting exposed to a new language which is R and literally with the sibling, Python.
If you have prior experience in ML there is no harm using Jupytor Notebook or Spyder or maybe with your classic terminal. First, you will have to get ready with the Anaconda platform installed on…
This is a continuation of the practical Capturing Network Traffic: Amazon EC2 Instance #1. Please have a read on that first and continue to this article.
In this article, I will be using FileZilla to transfer files from my Mac (having macOS Catalina) over to the Amazon EC2 I created in my previous article above. Then I will be using Telnet to connect to the server I deploy on the EC2 and Wireshark to capture the network traffic on calls to the server.
I thought of writing this story from scratch to implement the practical on macOS Catalina.
Let’s get our hands dirty…
I will be using my AWS Educate account for this tutorial.
Creating the EC2 instance is done on the AWS platform. So the tasks you carry out in this Step 1 do not differ from what Operating System you are on.
Login to your AWS educate account as follows
First let me introduce what is a binary tree.
Create a node class
Constructors don’t have a return type and they should be as the same as the class name.
Constructors are used to initialize the object’s state.
When is a Constructor called ?
Each time an object is created using new() keyword at least one constructor (it could be default constructor) is invoked to assign initial values to the data members of the same class.
A constructor is invoked at the time of object or instance creation.
Rules of writing a constructor:
>Constructor(s) of a class must has same name as the class name in which it resides.
>A constructor in Java…
In java program, it’s not crucial a class to be a public class.Meanwhile in a single java file there can be several classes defined and among them there can be only one class to a public class.
lets take an example…
This implies that If there is a public class in a java file the file should be named as
<public Class name>.java