Alshifa Hasnain

Alshifa Hasnain

Converting Code to Clarity

About

A professional technical content writer with Java programming skills. I have a desire to write informative and detailed Java articles for both beginner and professional developers. Having a strong background in HTML, CSS, JavaScript, Java, JDBC, JSP, Spring, and Hibernate.

221 Articles Published

Articles by Alshifa Hasnain

Page 15 of 23

Is string a primitive data type or an object in Java?

Alshifa Hasnain
Alshifa Hasnain
Updated on 28-Feb-2025 2K+ Views

In Java there are various data types present, the String type often leads to confusion regarding whether it is a primitive data type or an object(non-primitive data type ).  Primitive Data Types in Java Primitive data types are the most basic data types the Java language provides. Primitive data types are not objects and do not have methods or properties. Eg: int (32-bit), float(32-bit), double(64-bit ), etc.  What is String in Java? A string is not a primitive data type. Java.lang package provides the String class therefore, it is an object type. The String class provides methods to manipulate and operate ...

Read More

Can a final class be subclassed in Java?

Alshifa Hasnain
Alshifa Hasnain
Updated on 27-Feb-2025 2K+ Views

In Java Inheritance is a fundamental feature that allows a class to derive properties and behaviors from another class. In Java, not all classes can be subclassed. A final class is a special type of class that cannot be extended.  What is a Final Class in Java? In Java, a class is declared final using the final keyword. The final modifier for finalizing the implementations of classes, methods, and variables. When a class is marked as final, it means − It cannot be extended. All its methods remain unchanged in their ...

Read More

How to declare a local variable in Java?

Alshifa Hasnain
Alshifa Hasnain
Updated on 27-Feb-2025 1K+ Views

In Java, local variables are those that have been declared within a method, constructor, and block, and are only accessible within that defined scope. Such local variables are used when there is a need to store temporary data during the execution of a program. What is a Local Variable? Local variables are declared in methods, constructors, or blocks. Local variables are created when the method, constructor, or block is entered and the variable will be destroyed once it exits the method, constructor, or block. A local variable is a variable that is − Declared inside ...

Read More

Java ResultSetMetaData getScale() method with example

Alshifa Hasnain
Alshifa Hasnain
Updated on 27-Feb-2025 584 Views

In this article, we will learn the ResultSetMetaData getScale() method in Java. The ResultSetMetaData interface provides metadata about the columns in a ResultSet object. The getScale() method returns the number of digits to the right of the decimal point for a specified column. What is the getScale() method? The getScale() method of the ResultSetMetaData (interface) retrieves the number of digits after the right of the decimal point in the given column. This method accepts an integer value representing the index of a column. and returns an integer value representing the number of digits after the decimal in the specified column. Syntax ...

Read More

Java DatabaseMetaData getDriverName() method with example

Alshifa Hasnain
Alshifa Hasnain
Updated on 27-Feb-2025 489 Views

In this article, we will learn about the DatabaseMetaData getDriverName() method in Java. The DatabaseMetaData interface provides useful methods to obtain details about the database and the JDBC driver. One such method is getDriverName(), which returns the name of the JDBC driver being used. What is getDriverName() in Java? The getDriverName() method belongs to the DatabaseMetaData interface in Java's JDBC API. It retrieves the name of the JDBC driver currently connected to the database. Syntax String driver_name = metaData.getDriverName(); The method returns the following values − Returns a String representing the name of the ...

Read More

JavaScript regex program to display name to be only numbers, letters and underscore.

Alshifa Hasnain
Alshifa Hasnain
Updated on 27-Feb-2025 695 Views

In this article, we will learn the regex program to display names to be only numbers, letters, and underscores In Java. Validating user input is essential for maintaining data integrity and security in web applications.  JavaScript Regex for Name Validation Regular expressions regex is probably more powerful in defining patterns to search for in the text validations. A typical validation is confirming a name consists of only letters (A-Z, a-z), digits (0-9), and underscore (_). To ensure that a name contains only letters we can use the following regex − /^\w+$/ ^: Start of the string ...

Read More

JavaScript - Remove first n characters from string

Alshifa Hasnain
Alshifa Hasnain
Updated on 26-Feb-2025 468 Views

In this article, we will learn to calculate the union of two objects in JavaScript. The union of two objects results in a new object that contains all the properties of both objects. What is the Union of Two Objects? The union of two objects is the process of combining the properties of both objects into a single object. For example Input − const obj1 = { name: " ", email: " " }; const obj2 = { name: ['x'], email: ['y']}; Output − const output = { name: {" ", [x]}, email: {" ", [y]} }; Different Approaches ...

Read More

JavaScript union of two objects

Alshifa Hasnain
Alshifa Hasnain
Updated on 26-Feb-2025 747 Views

In this article, we will learn to calculate the union of two objects in JavaScript. The union of two objects results in a new object that contains all the properties of both objects. What is the Union of Two Objects? The union of two objects is the process of combining the properties of both objects into a single object. For example Input − const obj1 = { name: " ", email: " " }; const obj2 = { name: ['x'], email: ['y']}; Output − const output = { name: {" ", [x]}, email: {" ", [y]} }; Different Approaches ...

Read More

JavaScript ArrayBuffer Object

Alshifa Hasnain
Alshifa Hasnain
Updated on 25-Feb-2025 903 Views

In this article, we will learn about JavaScript ArrayBuffer objects. The ArrayBuffer object in JavaScript is a fundamental part of the Web API for efficiently handling binary data.  What is ArrayBuffer? The JavaScript ArrayBuffer object represents a generic, fixed-length raw binary data buffer. To manipulate the contents of an ArrayBuffer object we have to create a DataView object as we cannot manipulate the contents directly. We can read and write both using the DataView object. Syntax new ArrayBuffer(byteSize) The byteSize parameter specifies the array buffer size in bytes that will be created. Use Cases of ArrayBuffer Following are the use ...

Read More

JavaScript Prompt Example

Alshifa Hasnain
Alshifa Hasnain
Updated on 25-Feb-2025 838 Views

In this article, we will learn to use the prompt() function in Javascript. The prompt() method in JavaScript allows developers to collect user input through a pop-up dialog box. What is the prompt() Method in JavaScript? The prompt dialog box is very useful when you want to pop-up a text box to get user input. Thus, it enables you to interact with the user. The user needs to fill in the field and then click OK. This dialog box is displayed using a method called prompt(). Syntax var userInput = prompt("Message", "Default value"); The following are the parameters of the ...

Read More
Showing 141–150 of 221 articles
« Prev 1 13 14 15 16 17 23 Next »
Advertisements