Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Programming Articles - Page 1983 of 3366
2K+ Views
A module is an important concept introduced in Java 9. By using this concept, we can able to divide code into smaller components called modules. Therefore, each module has its own responsibility and declare its dependency on other modules to work properly. In order to declare a module, we need to include the "module-info.java" file to root source code.There are few types of "requires" clause in "module-info" file1) requires : By default, a module doesn't know other modules present in a module-path. So, it is necessary to add a line in our module-info.java: "requires" each time when we want to access ... Read More
207 Views
JShell is an interactive tool in Java 9 that allows user inputs, evaluates it, and prints output to the user.Unlike a value type, a reference type doesn't store its value directly. Instead, it will store the address where a value is stored. It means that a reference type contains a pointer to another memory location that holds the data. The reference types are String, arrays, class, and delegates.In the below code snippet, when we create a new instance of Animal, it can be created on the heap memory. The new Animal() creates an object on the Heap. Animal@73846619, the object is ... Read More
307 Views
The jdeprscan tool can be used for static analysis of classes, archives, and folders for the presence of API elements marked as deprecated. This tool only detects items marked as deprecated in Java SE, and it doesn't detect marked items in other libraries. All classes on which the examined class or set of classes depends must be available when compiling or running a class. In the absence of a dependent class, this tool provides a list of unavailable classes preceded by the error: cannot find a class.Below is the syntax for the jdeprscan tool.Syntaxjdeprscan [options] {dir | jar | class}The "jdeprscan" command can be supported by "jmods\jdk.jdeps.jmod" ... Read More
508 Views
JShell is a command-line tool used to evaluate simple statements, expressions, classes, methods, variables, etc.. and prints the output immediately to the user.An array in Java is also an object. We need to declare an array and then created. In order to declare a variable that holds an array of integers, we can mention like int[] array. In an array, the index starts from 0 to (length of array - 1).In the below code snippet, we can use an index to find the specific element from the array. It will be done by using an indexing operator: []. The expression marks[0] maps ... Read More
291 Views
Each primitive type in Java has a corresponding built-in wrapper class, and these wrapper classes are also immutable. Integer, Float, Double, Byte, and etc.. are some of the built-in wrapper classes. The main incentive of using such wrappers in our code is accessing type information about the corresponding primitive type, Auto-Boxing feature, where a primitive data is automatically promoted to an object reference type, and moving primitive type data around data structures.We can create an instance of Wrapper Classes by using a new operator, and also use the valueOf() method within types such as Integer to create a wrapper object. ... Read More
517 Views
In this tutorial, we are going to learn how to calculate Wind Chill Index in Python. We have the formula to calculate the WCI and it's straightforward. We are going to use the following formula to calculate the WCI.Twc(WCI) = 13.12 + 0.6215Ta – 11.37v+0.16 + 0.3965Tav+0.16whereTwc = Wind Chill Index (Based on Celsius temperature scale)Ta = Air Temperature (in degree Celsius)v = Wind Speed (in miles per hour)We are going to use the math module function wherever we need them. Using the math module function decreases the execution time of a program.Follow the below steps to complete the program.Import the math moduleInitialize the ... Read More
1K+ Views
In this tutorial, we are going to explore different methods to find whether a given number is valid or not. Let's start without further due.Method-1It's a general method to find prime numbers.If the number is less than or equal to one, return False.If the number is divisible by any number, then the function will return False.After the loop, return True.Example Live Demo# checking for prime def is_prime(n): if n
805 Views
In this tutorial, we are going to write an anonymous function using lambda to rearrange positive and negative number in a list. We need the pick the negative numbers and then positive numbers from a list to create a new one.AlgorithmLet's see how to solve the problem step by step.1. Initialize a list with negative and positive numbers. 2. Write a lambda expression the takes a list as an argument. 2.1. Iterate over the list and get negative numbers 2.2. Same for positive numbers 2.3. Combine both using concatination operator. 3. Return the resultant list.Note - Use ... Read More
501 Views
In this tutorial, we are going to learn about the logarithmic functions from math module. We have four variants of logarithmic functions. Pythons' provides all of them in the math module. Let's learn about them one by one.math.log(number, [Base])The math.log(number, [Base]) method is used to compute the logarithm of any Base. If we didn't specify any base value, then it will take e as default base.Note − You will get ValueError if you pass a negative number to the method.ExampleLet's see some examples. Live Demo# importing math module import math # logarithm with base 3 print(math.log(15, 7))OutputIf you run the above ... Read More
420 Views
In this tutorial, we are going to learn how to use dictionary comprehensions in Python. If you are already familiar with list comprehension, then it won't take much time to learn dictionary comprehensions.We need the key: value pairs to create a dictionary. How to get these key-value pairs using dictionary comprehension? See the general statement of dictionary comprehension.{key: value for ___ in iterable}We need to fill in the above statement to complete a dictionary comprehension. There are many ways to fill it. Let's see some of the most common ways.Let's see how to generate numbers as keys and their squares ... Read More