Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Articles by Ashin Vincent
24 articles
Difference between Go and Java.
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 MoreJava program to find Largest, Smallest, Second Largest, Second Smallest in an array
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 MoreFind average of a list in Java
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 MoreDifference between Scanner and BufferReader Class in Java
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 MoreDifferences between abstract class and concrete class in Java
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 MoreDuck Numbers in Java
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 MoreATM Program JAVA
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 MoreWhat is memory-mapped file in Java?
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 MoreXylem and Phloem Number in Java
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 MorePrint the season name of the year based on the month number in java
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