The HTML DOM cancelable event property is associated with the HTML events as JavaScript can react to these events. The cancelable event property returns a Boolean true or false indicating whether the event can be cancelled or not.SyntaxFollowing is the syntax for cancelable event property −event.cancelableExampleLet us see an example of cancelable event property − Hover over the button below to find out if onmouseover is cancellable event or not CLICK IT function cancelFunction(event) { var x = event.cancelable; if(x==true) document.getElementById("Sample").innerHTML = "The onmouseover event ... Read More
Enum in Java is a datatype which stores a set of constant values. You can use these to store fixed values such as days in a week, months in a year etc.You can define an enum using the keyword enum followed by the name of the enumeration as −enum Days { SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY }Just like arrays, the elements/constants in an enum are identified using numbers starting from 0 in the above example the days are identified using numbers as shown in the following illustration −Retrieving values from an enumYou can retrieve all the elements ... Read More
The HTML DOM Button type property is associated with the HTML element. The button element by default has type=”submit” i.e clicking on any button on the form will submit the form. The button type property sets or returns the type of button.SyntaxFollowing is the syntax for −Setting the button type property −buttonObject.type = "submit|button|reset"Here, the submit|button|reset are button type values. Submit is set by default.Submit − Makes the button a submit button.Button − Makes a normal clickable button.Reset − Makes a reset button that resets the form data.ExampleLet us see an example of the HTML DOM button type property − ... Read More
Strings in Java represents an array of characters. They are represented by the String class.Using compareTo() methodThe compareTo() method of the String class two Strings (char by char) it also accepts null values. This method returns an integer representing the result, if the value of the obtained integer is −0: Given two Strings are equal or, null.1 or less: The current String preceeds the argument.1 or more: The current String succeeds the argument.Exampleimport java.util.Scanner; public class CompringStrings { public static void main(String args[]) { Scanner sc = new Scanner(System.in); System.out.println("Enter your first string ... Read More
The HTML DOM Button object is associated with the element.PropertiesFollowing are the properties for the HTML DOM button object −PropertyDescriptionautofocusTo set or return whether a button is automatically focused or not when the page loads.disabledTo set or return whether a given button is disabled or not.formTo return the reference of the form containing the button.formActionTo set or return the formAction attribute value of a button.formEnctypeTo set or return the formEnctype attribute value of a button.formMethodTo set or return the formMethod attribute value of a button.formNoValidateTo set or return whether the form data should be validated or not on submission.formTargetTo ... Read More
The HTML DOM Button name property is associated with name attribute of the element. The name property is used to set or return the value of the name attribute of the button. The name attribute is used in forms to select an element using JavaScript.SyntaxFollowing is the syntax for −Setting the name property −buttonObject.name = nameHere, the name property value is used to denote the name of the button.ExampleLet us see an example of the button name property − BUTTON Click the button below and change the above button name. CHANGE function change() { ... Read More
The HTML DOM Button disabled property is associated with disabled attribute of the element .The button disabled property is used to set or return whether a given button is disabled or not. It is used to disable the button so that the user can no longer interact with the specified element. Setting the disabled property will grey the button by default in the web browsers.SyntaxFollowing is the syntax for −Setting the disabled property −buttonObject.disabled = true|falseHere, the true|false specifies if the given input button should be disabled or not.True − The button gets disabled.False − The button won’t get disabled.Let us ... Read More
This example demonstrates how do I pick up and hung up calls in android.Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml. Step 3 − Add the following code to src/MainActivity.javaimport android.Manifest; import android.content.pm.PackageManager; import android.support.v4.app.ActivityCompat; import android.support.v4.content.ContextCompat; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.widget.Toast; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ... Read More
A Set is a collection that cannot contain duplicate elements. It models the mathematical set abstraction.It does not allow duplicate elements and allow one null value at most.Set also adds a stronger contract on the behavior of the equals and hashCode operations, allowing Set instances to be compared meaningfully even if their implementation types differ.There are three classes implementing this interface −HashSet − Set implementation based on hash table.LinkedHashSet − HashSet implementation based on linked list.TreeSet − Set implementation based on trees.Null values in a Set objectAs per the definition a set object does not allow duplicate values but it ... Read More
The java.time package of Java provides API’s for dates, times, instances and durations. It provides various classes like Clock, LocalDate, LocalDateTime, LocalTime, MonthDay, Year, YearMonth etc. Using classes of this package you can get details related to date and time in much simpler way compared to previous alternatives.Java.time.LocalDate − This class represents a date object without time zone in ISO-8601 calendar system. The now() method of this class obtains the current date from the system clock.The toString() method of the LocalDate class converts the date value of the current Date object in to String and returns it.ExampleFollowing Java example accepts ... Read More
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP