Ramu Prasad

Ramu Prasad

48 Articles Published

Articles by Ramu Prasad

48 articles

How to create a zero-filled JavaScript array?

Ramu Prasad
Ramu Prasad
Updated on 11-Mar-2026 174 Views

To create a zero-filled JavaScript array, use the Unit8Array typed array.ExampleYou can try to run the following code:                    var arr1 = ["marketing", "technical", "finance", "sales"];          var arr2 = new Uint8Array(4);          document.write(arr1);          document.write("Zero filled array: "+arr2);          

Read More

Single level inheritance in Java

Ramu Prasad
Ramu Prasad
Updated on 11-Mar-2026 15K+ Views

Single Level inheritance - A class inherits properties from a single class. For example, Class B inherits Class A.Exampleclass Shape {    public void display() {       System.out.println("Inside display");    } } class Rectangle extends Shape {    public void area() {       System.out.println("Inside area");    } } public class Tester {    public static void main(String[] arguments) {       Rectangle rect = new Rectangle();       rect.display();       rect.area();    } }OutputInside display Inside areaHere Rectangle class inherits Shape class and can execute two methods, display() and area() as shown.

Read More

How to reverse the elements of an array using stack in java?

Ramu Prasad
Ramu Prasad
Updated on 11-Mar-2026 4K+ Views

Stack is an Abstract Data Type (ADT), commonly used in most programming languages. It is named stack as it behaves like a real-world stack, for example – a deck of cards or a pile of plates, etc.A stack is first in first out, it has two main operations push and pop. Push inserts data in to it and pop retrieves data from it.To reverse an array using stack initially push all elements in to the stack using the push() method then, retrieve them back using the pop() method into another array.Exampleimport java.util.Arrays; import java.util.Stack; public class ReversinArrayUsingStack {   ...

Read More

How to store the contents of arrays in a file using Java?

Ramu Prasad
Ramu Prasad
Updated on 11-Mar-2026 3K+ Views

You can use write data into a file using the Writer classes. In the example given below, we are writing the contents of the array using the BufferedWriter.Exampleimport java.io.BufferedWriter; import java.io.FileWriter; public class WritingStringArrayToFile {    public static void main(String args[]) throws Exception {       String[] myArray = {"JavaFX", "HBase", "OpenCV", "Java", "Hadoop", "Neo4j"};       BufferedWriter writer = new BufferedWriter(new FileWriter("myFile.txt", false));       for(int i = 0; i < myArray.length; i++) {          writer.write(myArray[i].toString());          writer.newLine();       }       writer.flush();       ...

Read More

How to redirect to another webpage using JavaScript?

Ramu Prasad
Ramu Prasad
Updated on 20-Apr-2022 22K+ Views

The window.location object contains the current location or URL information. We can redirect the users to another webpage using the properties of this object. window.location can be written without the prefix window.We use the following properties of the window.location object to redirect the users to another webpage −window.location.href- it returns the URL (href) of the current page.window.location.replace()- it replaces the current document with new document.window.location.assign() loads a new document.The syntaxes below are used to redirect to another web page. We omit the window prefix and use only location in all the program examples. You can try running the programs using ...

Read More

How to fix Array indexOf() in JavaScript for Internet Explorer browsers?

Ramu Prasad
Ramu Prasad
Updated on 24-Jun-2020 494 Views

To fix Array.indexOf() for Internet Explorer web browser, use the following −jQuery.inArray( value, array [, fromIndex ] )Add the following,

Read More

Why does the JavaScript need to start with &ldquo;;&rdquo;?

Ramu Prasad
Ramu Prasad
Updated on 23-Jun-2020 191 Views

JavaScript uses a semi-colon (;) to avoid any confusion in code, especially the beginning of a new line.ExampleYou can still use the following to avoid any chaos in the code −return {    'var':myVal } // using semi-colon; (function( $ ) {    // }

Read More

How to set the capitalization of a text with JavaScript?

Ramu Prasad
Ramu Prasad
Updated on 23-Jun-2020 266 Views

To set the capitalization, use the textTransform property in JavaScript. Set it to capitalize, if you want the first letter of every word to be a capital letter.ExampleYou can try to run the following code to return the capitalization of a text with JavaScript −           Capitalize Text                This is demo text! This is demo text!                      function display() {             document.getElementById("myID").style.textTransform = "capitalize";          }          

Read More

How to search the querystring part of the href attribute of an area in JavaScript?

Ramu Prasad
Ramu Prasad
Updated on 23-Jun-2020 182 Views

To get the querystring of the href attribute of an area, use the search property. You can try to run the following code to search the querystring −Example                                                var x = document.getElementById("myarea").search;          document.write("Querystring: "+x);          

Read More

How to get the list of document properties which can be accessed using W3C DOM?

Ramu Prasad
Ramu Prasad
Updated on 23-Jun-2020 254 Views

The following are the document properties which can be accessed using W3C DOM −Sr.NoProperty & Description1BodyA reference to the Element object that represents the tag of this document.Ex − document.body2DefaultViewIts Read-only property and represents the window in which the document is displayed.Ex − document.defaultView3DocumentElementA read-only reference to the tag of the document.Ex − document.documentElement8/31/20084ImplementationIt is a read-only property and represents the DOMImplementation object that represents the implementation that created this document.Ex − document.implementation

Read More
Showing 1–10 of 48 articles
« Prev 1 2 3 4 5 Next »
Advertisements