Arushi has Published 152 Articles

Create class Objects in Java using new operator

Arushi

Arushi

Updated on 30-Jul-2019 22:30:24

474 Views

Class objects can be created in Java by using the new operator. A class is instantiated by the new operator by allocating memory for the object dynamically and then returning a reference for that memory. A variable is used to store the memory reference.A program that demonstrates this is given ... Read More

Demonstrate constructors in a Multilevel Hierarchy in Java

Arushi

Arushi

Updated on 30-Jul-2019 22:30:24

1K+ Views

Multilevel inheritance is when a class inherits a class which inherits another class. An example of this is class C inherits class B and class B in turn inherits class A.A program that demonstrates constructors in a Multilevel Hierarchy in Java is given as follows:Example Live Democlass A {    A() ... Read More

Class that contains a String instance variable and methods to set and get its value in Java

Arushi

Arushi

Updated on 30-Jul-2019 22:30:24

473 Views

A class declaration can contain a String instance and methods to set and get its value in Java.A program that demonstrates this is given as follows:Example Live Democlass Name {    private String name;    public void setName(String n) {       name = n;    }    public String ... Read More

Zip Code validation using Java Regular Expressions

Arushi

Arushi

Updated on 30-Jul-2019 22:30:24

1K+ Views

The zip code can be validated using the java.util.regex.Pattern.matches() method. This method matches the regular expression for the zip code and the given input zip code and returns true if they match and false otherwise.A program that demonstrates this is given as follows:Example Live Demopublic class Demo {    public static ... Read More

Demonstrate Private access modifier in Java

Arushi

Arushi

Updated on 30-Jul-2019 22:30:24

128 Views

The data members and methods of a class can be accessed only from within their declared class if they are specified with the private access modifier. The keyword private is used to specify this modifier.A program that demonstrates the private access modifier in Java is given as follows:Example Live Democlass A ... Read More

Set the size of a Vector in Java

Arushi

Arushi

Updated on 30-Jul-2019 22:30:24

360 Views

The java.util.Vector.setSize() method can be used to set the size of a Vector in Java. If the new size that is set is greater than the old size of the Vector, then null values are added to the positions created. If the new size that is set is lesser than ... Read More

Use a quantifier to find a match in Java

Arushi

Arushi

Updated on 30-Jul-2019 22:30:24

63 Views

One of the quantifiers is the plus(+). This matches one or more of the subsequence specified with the sequence.A program that demonstrates using the quantifier plus(+) to find a match in Java is given as follows:Example Live Demoimport java.util.regex.Matcher; import java.util.regex.Pattern; public class Demo {    public static void main(String args[]) ... Read More

Stack in Java Programming

Arushi

Arushi

Updated on 30-Jul-2019 22:30:23

187 Views

Stack is a subclass of Vector that implements a standard last-in, first-out stack. Stack only defines the default constructor, which creates an empty stack. Stack includes all the methods defined by Vector, and adds several of its own. Stack( ) Apart from the methods inherited from its parent ... Read More

How to convert HTML to PDF using Python

Arushi

Arushi

Updated on 30-Jul-2019 22:30:23

1K+ Views

Python provides Pdfcrowd API v2 which is convert HTML documents to PDF. This API is very easy to use and the integration takes only a couple of lines of code. Installation Install the client library from PyPI $ pip install pdfcrowd Conversion will be completed in following 3 ... Read More

Python program to convert an array to an ordinary list with the same items

Arushi

Arushi

Updated on 30-Jul-2019 22:30:23

123 Views

The array is given. Our task is to convert an array to an ordinary list. We solve this problem with the help of tolist() function. This function return the array as a (possibly nested) list. Algorithm Step 1: Given an array. Step 2: convert the array to a list ... Read More

Advertisements