A yield() method is a static method of Thread class and it can stop the currently executing thread and will give a chance to other waiting threads of the same priority. If in case there are no waiting threads or if all the waiting threads have low priority then the same thread will continue its execution. The advantage of yield() method is to get a chance to execute other waiting threads so if our current thread takes more time to execute and allocate processor to other threads. Syntax public static void yield() Example class MyThread extends Thread { public void run() { ... Read More
A static inner class can be instantiated without the need for an instance of the outer class. In general, an Inner class is a part of nested class, called Non-static nested classes in Java. The types of inner classes are member inner class, anonymous inner class, and local inner class. We can instantiate a static inner class with reflection using InnerClass.class.newInstance(). If we need an instance of the outer class to instantiate a non-static inner class, we can specify it before a new operator. Example import java.lang.reflect.*; public class InnerclassWithReflectionTest { public static void main(String args[]) { ... Read More
HTML, which stands for HyperText Markup Language, is a combination of Hypertext and Markup language which we can use to structure a web page and its content. In this article, we will see how we can add the copyright symbol to our web page. Approach The copyright symbol is not present on the keyboard. Therefore, we must use another method to add this to our webpage. We are going to see three different methods − Using hexadecimal code Using HTML code Using HTML entity Method 1: Using Hexadecimal Code The hexadecimal code for the copyright symbol is © ... Read More
In this article we are going to learn about how to add an article in HTML5. One of the new sectioning elements in HTML5 is the tag. An article is represented in HTML using the tag. More specifically, the content contained in the element is distinct from the rest of the site's content (even though it can be related). Let’s consider the following examples to know how to add an article in HTML5 Example 1 In the following examples we are using inline styling in an article element. ... Read More
Videos can be easily from YouTube to your web page. You need to just embed the videos. At first, get the Video id − Step1: Go to the Video and right click on it. Select “Stats for nerds” − On clicking, you will get the following dialog box displaying the stats − Above you can see the video id is F6m0ghjadlw. Now, we will embed the same video using its id − Example Learn WordPress WordPress Installation Following is the video demonstrating how to install WordPress on localhost ... Read More
In this article we are going to learn how to wrap a text in tag in HTML. The HTML tag is used to present preformatted block of text. Preformatted text refers to text that has already been formatted and should not be formatted further. The tag also takes a closing tag () like lot of other HTML elements. Syntax Following is the basic syntax for tag. Enter text here… When you present a text in the webpage via tag, it is shown in the format you wrote it ... Read More
To draw HTML Image Elements on a canvas element, use the drawImage() method. This method defines an Image variable with src = "mySVG.svg", and use drawImage on load. var myImg = new Image(); myImg.onload = function() { ctx.drawImage(myImg, 0, 0); } img.src = "http://www.example.com/files/sample.svg ";
To create a linear gradient that looks like rainbow color, you can try to run the following code - Example #demo { height: 100px; background: linear-gradient(to right, red,orange,yellow,green,blue,indigo,violet); } Linear Gradient Rainbow
Inline Frame is known as iframe in HTML. The tag designates a rectangular area within the content where a different document, complete with scroll bars and borders, may be displayed by the browser. To embed another document inside the current HTML document, use an inline frame. An element's reference can be specified using the HTML iframe name property. In JavaScript, a reference to an element is also made using the name attribute. Iframes are essentially used to display a webpage inside the one that is now shown. The URL of the document that contains the iframe is specified ... Read More
The delete() function of the Set object accepts a value and removes it from the current Set object. Syntax Its Syntax is as follows setObj.delete() Example JavaScript Example const setObj = new Set(); setObj.add('Java'); setObj.add('JavaFX'); setObj.add('JavaScript'); setObj.add('HBase'); document.write("Contents of the Set before deletion:"); document.write(""); for (let item of setObj) { document.write(item); document.write(""); } ... Read More