Category: Java

Array In Java

This blog explain about Array in detailed. Array:- A group of similar data types is called an array. Arrays are used in computer programming to organize the same type of data. To declare an array, define the variable type with square brackets. Array can store the primitive datatypes such as int, char, double, and float. Array occupy […]

Read More

Final Keyword in Java

final keyword is used in different contexts. First of all, final is a non-access modifier applicable only to a variable, a method, or a class. The following are different contexts where final is used. Final Variable: When applied to a variable, the final keyword indicates that the variable’s value cannot be changed after it has been initialized. This is typically […]

Read More

JAVA New Features – Stream – Part 3

This blog explains about Stream part 3 in java is given below :  map(Function) map(List of Objects -> List of Objects) Example 2: It should be rewritten as below: limit() skip() total reduce() //Converting ArrayList to Array //Get max from an ArrayList Parallel Stream //ParallelStream //Sorting Based on Key: Alphabetical Order //anyMatch() anyMatch() //allMatch() //noneMatch()

Read More

JAVA Features – Stream API – Part 2

This blog explains about Stream API in java is given below :  Print Array values in Sorted Order: Note: Intermediate Operations are Lazy OperationsTerminal Operations are Eager Operations Find average of elements in an Array: Finding max of given Array: Finding minimum of given Array: Finding First value of given Array: Finding any value of […]

Read More

JAVA New Features – Lambda Expressions, Functional Interfaces

This Blog explains about Java 8 – New Features – Lambda Expressions, Functional Interfaces. Lambda Expressions: WHY: Functional Programming WHAT: Anonymous Functions: Closures Function – Method: HOW: Eg: 1 1) Remove Method Name 2) Remove return datatype 3) Remove Access Modifiers if any. 4) Add -> in between () and {} Eg. 2: Eg. 3: […]

Read More

Access Modifiers or Access Specifiers

In Java, access modifiers are keywords used to define the accessibility or visibility of classes, variables, methods, and constructors. There are four types of access modifiers in Java: 1. public: The public access modifier in Java is used to declare that a class, variable, method, or constructor is accessible from anywhere in the program, both […]

Read More

static vs non static java

Image referred from: http://www.sitesbay.com/java/images/basic-java/Static-and%20non-Static-Method-rules.png static: In Java, the ‘static’ keyword is used to declare members (variables and methods) that belong to the class itself, rather than to individual instances of the class. When a member is declared as ‘static’, it means that it is shared among all instances of the class. This allows you to […]

Read More