Detect If JavaScript is Disabled in a Browser

radhakrishna
Updated on 12-Sep-2019 08:46:00

7K+ Views

To detect if JavaScript is disabled in a web browser, use the tag. The HTML tag is used to handle the browsers, which do recognize tag but do not support scripting. This tag is used to display an alternate text message.Here’s an example,           HTML noscript Tag                                                    Your browser does not support JavaScript!          

Get Exception Log from Console and Write to External File in Java

Maruthi Krishna
Updated on 12-Sep-2019 08:39:04

1K+ Views

There are several logging frame works available to log your data in to files. You can also define your own method.Example − Using I/O packageFollowing Java program has an array storing 5 integer values, we are letting the user to choose two elements from the array (indices of the elements) and performing division between them. We are wrapping this code in try block with three catch blocks catching ArithmeticException, InputMismatchException and, ArrayIndexOutOfBoundsException. In each of them we are invoking the writeToFile() method.This method accepts an exception object, and appends it to a file using the write() method of the Files ... Read More

Difference Between Comments and Documentation in JavaScript

radhakrishna
Updated on 12-Sep-2019 08:35:18

674 Views

/*…*/ and /**…*/ are multi-line comments. The following is a multi line comment in JavaScript./*    * This is a multiline comment in JavaScript    * It is very similar to comments in C Programming */The following example shows how to use multi-line comments in JavaScript.     The comment /** */ is for  PHPDocumentator ,  which is used to make automatic documentation.

Difference Between lang and type Attributes in a Script Tag

Arushi
Updated on 12-Sep-2019 08:31:25

318 Views

JavaScript lang attributeThis attribute specifies what scripting language you are using. Typically, its value will be javascript. Although recent versions of HTML (and XHTML, its successor) have phased out the use of this attribute.JavaScript type attributeThis attribute is what is now recommended to indicate the scripting language in use and its value should be set to "text/javascript".Here you can see how it is used:Live Demo                              

Why JavaScript is Case-Sensitive but HTML is Not

varun
Updated on 12-Sep-2019 08:28:32

566 Views

A script is in plain text and not just markup like HTML, which is case insensitive. In JavaScript, the while keyword should be "while", not "While" or "WHILE". Case sensitivity is important since it is closely related to HTML, but some methods and events are mentioned differently. JavaScrip has a strict syntax to process the client-side-scripts written in JavaScript.Some tags and attributes in HTML have the same name as JavaScript objects and properties. In HTML, the attribute and tag names are case-insensitive. The close association of HTML and JavaScript can lead to confusion, so case sensitivity is more important in ... Read More

Java Finally Block Explanation

Maruthi Krishna
Updated on 12-Sep-2019 08:26:37

219 Views

The finally block follows a try block or a catch block. A finally block of code always executes, irrespective of occurrence of an Exception.The return statement in the method too does not stop the finally block from getting executed.ExampleIn the following Java program we are using return statement at the end of the try block still, the statements in the finally block gets executed. Live Demopublic class FinallyExample {    public static void main(String args[]) {       int a[] = new int[2];       try {          System.out.println("Access element three :" + a[3]);     ... Read More

Guide Lines for Using Wildcards in Java

Maruthi Krishna
Updated on 12-Sep-2019 08:22:22

179 Views

Instead of the typed parameter in generics (T) you can also use “?”, representing an unknown type. You can use a wild card as a −Type of parameter.Field.Local field.The only restriction on wilds cards is that you cannot it as a type argument of a generic method while invoking it.Java provides 3 types of wild cards namely upper-bounded, lower-bounded, un-bounded. There are two types of wildcards in Java −Upper-bounded wildcards − Upper bounds in wild cards is similar to the bounded type in generics. Using this you can enable the usage of all the subtypes of a particular class as a ... Read More

Types of Comments in JavaScript

Prabhas
Updated on 12-Sep-2019 08:20:29

185 Views

Single Line commentThe following is a single line comment in JavaScript. Any text between a // and the end of a line is treated as a comment and is ignored by JavaScript.// This is a comment. It is similar to comments in C++Multi-Line commentThe following is a multi-line comment in JavaScript./*    * This is a multiline comment in JavaScript    * It is very similar to comments in C Programming */

Difference Between Single-Line and Multi-Line Comments in JavaScript

varma
Updated on 12-Sep-2019 08:19:19

680 Views

Single Line commentThe following is a single line comment in JavaScript. Any text between a // and the end of a line is treated as a comment and is ignored by JavaScript.// This is a comment. It is similar to comments in C++Multi-Line commentThe following is a multi-line comment in JavaScript./*    * This is a multiline comment in JavaScript    * It is very similar to comments in C Programming */

What Are Unbounded Wildcards in Java Generics Method

Maruthi Krishna
Updated on 12-Sep-2019 08:17:35

2K+ Views

Generics is a concept in Java where you can enable a class, interface and, method, accept all (reference) types as parameters. In other words it is the concept which enables the users to choose the reference type that a method, constructor of a class accepts, dynamically. By defining a class as generic you are making it type-safe i.e. it can act up on any datatype.To define a generic class you need to specify the type parameter you are using in the angle brackets “” after the class name and you can treat this as datatype of the instance variable an ... Read More

Advertisements