Ashin Vincent

Ashin Vincent

About

I am a content writer specializing in Java programming, creating clear and practical guides for developers. Let’s make coding easier together!

24 Articles Published

Articles by Ashin Vincent

24 articles

Difference between Go and Java.

Ashin Vincent
Ashin Vincent
Updated on 17-Apr-2025 535 Views

Both Go and Java are popular backend programming languages, and each has its own unique features. Java is an older language with a large community support, whereas Go is a comparatively newer language developed by Google. In this article, we will learn more about the differences between Go and Java. Go Language Go, also called Golang, is an open-source programming language developed by Robert Griesemer, Rob Pike, and Ken Thompson at Google. It was created to build large and complex software systems more easily. It is a statically typed and compiled programming language that has a simple and ...

Read More

Java program to find Largest, Smallest, Second Largest, Second Smallest in an array

Ashin Vincent
Ashin Vincent
Updated on 16-Apr-2025 5K+ Views

In this problem we are given an array of numbers, and we have to find the largest, smallest, second largest, and second smallest elements in an array in Java. Let’s understand the problem better with the help of an example: Input int arr[] = {55, 10, 8, 90, 43, 87, 95, 25, 50, 12}; Output Smallest element = 8 2nd Smallest element = 10 Largest element = 95 2nd Largest element = 90 To solve this problem, use the following approaches: Using Arrays.sort() Using nested for-loops Optimized one-pass approach Using Arrays.sort() In this ...

Read More

Find average of a list in Java

Ashin Vincent
Ashin Vincent
Updated on 16-Apr-2025 1K+ Views

Given a list of numbers, our task is to calculate the average of this list. The average of a list can be found by adding all the elements in the list and dividing the sum by the total number of elements. In this article we will learn different methods to implement this in Java. There are multiple ways in Java to find the average of a list. In this article we will explore two different approaches: Using Java Streams Using for loop Find Average of a List Using Java Streams This approach shows how to find ...

Read More

Difference between Scanner and BufferReader Class in Java

Ashin Vincent
Ashin Vincent
Updated on 16-Apr-2025 13K+ Views

Scanner and BufferedReader classes are used to read input from an external system. Scanner is normally used when we know input is of type string or of primitive types, and BufferedReader is used to read text from character streams while buffering the characters for efficient reading of characters. What is Scanner Class? The Scanner class is included in the java.util package. It is mostly used when the data type of the input is already known. We commonly use it with data ty+pes like strings, integers, floats, and booleans. It has built-in methods like nextInt(), nextDouble(), and nextLine() that help ...

Read More

Differences between abstract class and concrete class in Java

Ashin Vincent
Ashin Vincent
Updated on 16-Apr-2025 13K+ Views

Abstract class and concrete class are fundamental concepts of object oriented programming in Java. In this article, we will learn the differences between an abstract class and concrete class. What is an Abstract Class? An abstract class is a class that cannot be used to create objects. It can only be accessed using its subclasses. It can contain abstract methods, which are methods without a body. It acts as a blueprint for its subclasses. It can also contain concrete or regular methods. Example This example shows how to implement an abstract class in java: ...

Read More

Duck Numbers in Java

Ashin Vincent
Ashin Vincent
Updated on 28-Feb-2025 791 Views

A duck number is a positive number that contains a zero in it, but the first digit of the number cannot be a zero. For example, 10305, 20050, and 603 are duck numbers, while 0349 and 2987 are not duck numbers, as 0349 starts with 0 and 2987 does not contain 0 in it. The following are the approaches to find the duck number in Java − Using a while Loop Using the contains() operator Let’s understand each approach in detail. Finding Duck Number Using a While Loop In this approach, we take a number as input and ...

Read More

ATM Program JAVA

Ashin Vincent
Ashin Vincent
Updated on 28-Feb-2025 2K+ Views

In this article, we will learn how to build a simple ATM machine program in Java. This program lets users choose from the options displayed on the screen. Before choosing the options, the user has to enter their ATM PIN for verification. The default PIN will be '1234', which can be changed if needed. If the PIN is wrong, you will be exited from the program. If the PIN is correct, then the user can choose from the following − Java ATM Program Operations The following are the operations that you can perform with the program − ...

Read More

What is memory-mapped file in Java?

Ashin Vincent
Ashin Vincent
Updated on 28-Feb-2025 519 Views

Memory mapping is a technique in Java that gives direct access to files through memory (RAM). A memory-mapped file connects disk content straight to RAM, which lets Java applications handle files as memory segments. This makes files to be treated as a large array and is much faster than regular file operations like read() or write(). This requires fewer system calls and makes file operations faster even for very large files. The java.nio package helps us to implement memory-mapped file operations. This package contains the MappedByteBuffer class, which enables efficient file reading and writing from memory. Use cases of memory-mapped ...

Read More

Xylem and Phloem Number in Java

Ashin Vincent
Ashin Vincent
Updated on 28-Feb-2025 2K+ Views

A number is a Xylem number if the sum of extreme digits (first and last) equals the sum of its mean digits (all digits except first and last). If the sum of the extreme digits does not match the sum of the mean digits, then it is a Phloem number. We can understand it with the help of examples − Example 1 Take the number 12326: Sum of its extremes is 1+6=7. The sum of its mean digits is 2+3+2=7. Sum of extremes = Sum of mean digits, so it is a xylem number. Example 2 The number is ...

Read More

Print the season name of the year based on the month number in java

Ashin Vincent
Ashin Vincent
Updated on 28-Feb-2025 537 Views

In this article, we will explore different methods to find the season name from the month number in Java. When the user inputs the month number, the output should be the season by the name associated with the month. If the user enters 1 as the month number, the month is January, so the output will be Winter. Given below is the season classification by months Winter: December (12), January (1), February (2) Spring: March (3), April (4), May (5) Summer: June (6), July (7), August (8) Autumn: September (9), October (10), November (11) We can achieve this using several ...

Read More
Showing 1–10 of 24 articles
« Prev 1 2 3 Next »
Advertisements