Home » Java » Core Java

Core Java

Java Is Becoming What COBOL Was – Will It Become What COBOL Is?

Any computer science graduate from a university, technical school or community college is trained in it. Every company of any stature uses the language and has a cadre of programmers capable in it. It is the lingua franca that drives businesses. This was COBOL in 1985. Today, it’s Java. While there are differences, these two languages share enough similarity in their ...

Read More »

How to write a C like Sizeof function in Java

If you have just started learning Java and came from C background then you might have noticed some difference between Java and C programming language e.g. String is an object in Java and not a NULL terminated character array. Similarly, there is is no sizeof() operator in Java. All primitive values have predefined size e.g. int is 4 bytes, char ...

Read More »

Machine Learning in Java, part 2

Welcome to the second part of the tutorial for scoring your PMML files using  LightningScorer, which is a side project of mine. Let’s find out how additional parameters work. The initial steps are similar to the first part of the tutorial. Get your local copy first git clone https://github.com/sezinkarli/lightningscorer.git and build it with maven mvn clean install and start it ...

Read More »

Functional Java by Example | Part 4 – Prefer Immutability

This is part 4 of the series called “Functional Java by Example”. In previous part we talked a bit about side effects and I’d like to elaborate a bit more about how we can prevent having our data manipulated in unexpected ways by introducing immutability into our code. If you came for the first time, it’s best to start reading ...

Read More »

Go Full Stack with Java in a Jiffy

Here is a look at how you can write a full stack database web application without using SQL, HQL, PHP, ASP, HTML, CSS or Javascript and instead relying purely on Java using Vaadin’s UI layer and Speedment Stream ORM. Ever wanted to quickly create a web application connected to your existing database or build a professional application with short time-to-market ...

Read More »

Infinite Sets in Java 9

A Set A Set is a collection of elements whereby any given element in the Set only appears once. More formally, a set contains no pair of elements e1 and e2 such that e1.equals(e2). We can easily create Set in Java 9 like this: final Set<Integer> s = Set.of(1, 2, 3); System.out.println(s); This might produce the following output: [2, 3, ...

Read More »

JDK 11: Beginning of the End for Java Serialization?

In the blog post “Using Google’s Protocol Buffers with Java,” I quoted Josh Bloch’s Third Edition of Effective Java, in which he wrote, “There is no reason to use Java serialization in any new system you write.” Bloch recommends using “cross-platform structured-data representations” instead of Java’s deserialization. The proposed JDK 11 API documentation will include a much stronger statement about ...

Read More »

JDK 8 BigInteger Exact Narrowing Conversion Methods

In the blog post “Exact Conversion of Long to Int in Java,” I discussed using Math.toIntExact(Long) to exactly convert a Long to an int or else throw an ArithmeticException if this narrowing conversion is not possible. That method was introduced with JDK 8, which also introduced similar narrowing conversion methods to the BigInteger class. Those BigInteger methods are the topic ...

Read More »

Java 8 language features in Nutshell – Part 1

Hello Friends, It has been quite long when Java 8 was released and now it is getting used more and more. In this post, we will discuss following topics of Java 8. 1.Functional Interface 2.Lambda expression 3.Default Methods 1. Functional Interface What is Functional Interface? Interface with one and only one abstract method is a Functional Interface, as it is ...

Read More »