Base 64 Encoding Decoding-DefaultMethods
Base 64 Encoding Decoding-DefaultMethods
Base 64 is an encoding scheme that converts binary data into text format so that encoded textual
data can be easily transported over network un-corrupted and without any data loss.
The Basic encoding means no line feeds are added to the output and the output is mapped to a set
of characters in A-Za-z0-9+/ character set and the decoder rejects any character outside of this set.
The default methods were introduced to provide backward compa bility so that exis ng interfaces
can use the lambda expressions without implemen ng the methods in the implementa on class.
Sta c Methods:
The interfaces can have sta c methods as well which is similar to sta c method of classes.
interface TestInterface
{
public void square (int a);
sta c void show()
{
System.out.println("Sta c Method Executed");
}
}
class TestClass implements TestInterface
{
public void square (int a)
{
System.out.println(a*a);
}
public sta c void main(String args[])
{
TestClass d = new TestClass();
d.square(4);
TestInterface.show();
}
}
16
Sta c Method Executed
interface TestInterface2
{
default void show()
{
System.out.println("Default TestInterface2");
}
}
class TestClass implements TestInterface1, TestInterface2
{
public void show()
{
TestInterface1.super.show();
TestInterface2.super.show();
}
public sta c void main(String args[])
{
TestClass d = new TestClass();
d.show();
}
Default TestInterface1
Default TestInterface2