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
Articles by Alshifa Hasnain
Page 15 of 23
Is string a primitive data type or an object in Java?
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 MoreCan a final class be subclassed in Java?
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 MoreHow to declare a local variable in Java?
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 MoreJava ResultSetMetaData getScale() method with example
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 MoreJava DatabaseMetaData getDriverName() method with example
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 MoreJavaScript regex program to display name to be only numbers, letters and underscore.
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 MoreJavaScript - Remove first n characters from string
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 MoreJavaScript union of two objects
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 MoreJavaScript ArrayBuffer Object
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 MoreJavaScript Prompt Example
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