Programming Articles - Page 2164 of 3366

Differences between Procedural and Object Oriented Programming

Kiran Kumar Panigrahi
Updated on 15-Sep-2023 02:20:07

40K+ Views

Both Procedural Programming and Object Oriented Programming are high-level languages in programming world and are widely used in the development of applications. On the basis of nature of developing the code, both languages have different approaches on basis of which both are differentiate from each other. In this article, we will discuss the important differences between procedural oriented programming and object oriented programming. But before going into the differences, let's start with some basics. What is Procedural Programming? Procedural Programming is a programming language that follows a step-by-step approach to break down a task into a collection of variables ... Read More

How to implement DoubleBinaryOperator using lambda and method reference in Java?

raja
Updated on 13-Jul-2020 12:28:40

405 Views

DoubleBinaryOperator is a functional interface defined in java.util.function package. It accepts two parameters of type double as input and produces another double value as a result. DoubleBinaryOperator interface can be used as an assignment target for a lambda expression or method reference and has only one abstract method applyAsDouble().Syntax@FunctionalInterface public interface DoubleBinaryOperator {  double applyAsDouble(double left, double right); }Example-1import java.util.function.DoubleBinaryOperator; public class DoubleBinaryOperatorTest {    public static void main(String args[]) {       // using lambda expression       DoubleBinaryOperator sum = (d1, d2) -> d1 + d2;       DoubleBinaryOperator mul = (d1, d2) -> d1 * d2;       DoubleBinaryOperator div = ... Read More

Difference between var and dynamic in C#

Mahesh Parahar
Updated on 24-Feb-2020 11:25:58

6K+ Views

As we know that programming in any language get starts with declaration a variable after which its definition and logic implementation take place. So it is one of the most important factors to know that how to declare variable in any programming language before starts coding in it.Now if we take an instance of C# language there is change in declaration in variable with the advancement in the language. As in former version of C# all the code written was validated at the compile time itself which made it as Static typed language where variables are getting declared using var ... Read More

Difference between Traditional Collections and Concurrent Collections in java

Mahesh Parahar
Updated on 17-Jun-2025 16:29:14

1K+ Views

In Java, as we know, Collections are one of the most important concepts that make Java a powerful language in itself. It's the support of collections in Java that makes it support any type of data in a convenient and efficient way, along with possible CRUD operations over them. But on the same phase, when collections get exposed to a multi-threading its performance gets somewhat degraded because somewhere collections lack the support for a multi-threading environment. To overcome this limitation, Java introduces Concurrent Collections, which not only overcome the multi-threading environment limitation but also enhance Java to perform with multiple ... Read More

Difference between Static and Shared libraries

Mahesh Parahar
Updated on 24-Feb-2020 11:03:30

3K+ Views

In programming context library is something which has some sort of that code which is pre compiled and could get reused in any program for some specific functionality or feature.Now on the basis of execution and storage of this code library is classified in two types i.e Static library and Shared library.Following are the important differences between Static library and Shared library.Sr. No.KeyStatic libraryShared library1DefinitionStatic library is the library in which all the code to execute the file is in one executable file and this file get copied into a target application by a compiler, linker, or binder, producing an ... Read More

How to implement ActionEvent using method reference in JavaFX?

raja
Updated on 13-Jul-2020 12:16:32

2K+ Views

The javafx.event package provides a framework for Java FX events. The Event class serves as the base class for JavaFX events and associated with each event is an event source, an event target, and an event type. An ActionEvent widely used when a button is pressed.In the below program, we can implement an ActionEvent for a button by using method reference.Exampleimport javafx.application.*; import javafx.beans.property.*; import javafx.event.*; import javafx.scene.*; import javafx.scene.control.*; import javafx.scene.layout.*; import javafx.stage.*; import javafx.scene.effect.*; public class MethodReferenceJavaFXTest extends Application {    private Label label;    public static void main(String[] args) {       launch(args);    }    @Override    public void start(Stage primaryStage) {   ... Read More

How to implement the IntPredicate interface using lambda and method reference in Java?

raja
Updated on 13-Jul-2020 12:17:37

458 Views

IntPredicate interface is a built-in functional interface defined in java.util.function package. This functional interface accepts one int-valued argument as input and produces a boolean value as an output. This interface is a specialization of the Predicate interface and used as an assignment target for a lambda expression or method reference. It provides only one abstract method, test ().Syntax@FunctionalInterface public interface IntPredicate {  boolean test(int value); }Example for Lambda Expressionimport java.util.function.IntPredicate; public class IntPredicateLambdaTest {    public static void main(String[] args) {       IntPredicate intPredicate = (int input) -> {   // lambda expression          if(input == 100) {     ... Read More

Character class p{javaLowerCase} Java regex.

Maruthi Krishna
Updated on 10-Jan-2020 09:59:42

550 Views

This character class \p{javaLowerCase} matches lower case letters. This class matches the characters which returns true when passed as a parameter to the isLowerCase() method of the java.lang.Character class.Example 1 Live Demoimport java.util.Scanner; import java.util.regex.Matcher; import java.util.regex.Pattern; public class RegexExample {    public static void main(String args[]) {       //Reading String from user       System.out.println("Enter a string");       Scanner sc = new Scanner(System.in);       String input = sc.nextLine();       //Regular expression       String regex = "[\p{javaLowerCase}]";       //Compiling the regular expression       Pattern pattern = ... Read More

Posix character classes p{Space} Java regex.

Maruthi Krishna
Updated on 09-Jan-2020 10:43:03

521 Views

This class matches white space characters. i.e. \t, , \x, 0B, \f, \r.Example 1 Live Demoimport java.util.Scanner; import java.util.regex.Matcher; import java.util.regex.Pattern; public class SpaceCharacters {    public static void main(String args[]) {       //Reading String from user       System.out.println("Enter a string");       Scanner sc = new Scanner(System.in);       String input = sc.nextLine();       //Regular expression       String regex = "[\p{Space}]";       //Compiling the regular expression       Pattern pattern = Pattern.compile(regex);       //Retrieving the matcher object       Matcher matcher = pattern.matcher(input);   ... Read More

Posix character classes p{XDigit} Java regex.

Maruthi Krishna
Updated on 09-Jan-2020 10:38:16

407 Views

This class matches hexa-decimal characters i.e. [0-9a-fA-F].Example 1 Live Demoimport java.util.Scanner; import java.util.regex.Matcher; import java.util.regex.Pattern; public class SpaceCharacters {    public static void main(String args[]) {       //Reading String from user       System.out.println("Enter a string");       Scanner sc = new Scanner(System.in);       String input = sc.nextLine();       //Regular expression       String regex = "[\p{XDigit}]";       //Compiling the regular expression       Pattern pattern = Pattern.compile(regex);       //Retrieving the matcher object       Matcher matcher = pattern.matcher(input);       int count = 0; ... Read More

Advertisements