Abhinaya has Published 62 Articles

Why multiple inheritance is not supported in Java

Abhinaya

Abhinaya

Updated on 07-Sep-2023 00:44:29

36K+ Views

In Java, a class cannot extend more than one class. Therefore following is illegal −Examplepublic class extends Animal, Mammal{}However, a class can implement one or more interfaces, which has helped Java get rid of the impossibility of multiple inheritances.The reason behind this is to prevent ambiguity.Consider a case where class ... Read More

How to check whether a string contains a substring in JavaScript?

Abhinaya

Abhinaya

Updated on 20-Apr-2022 12:44:47

613 Views

JavaScript provides us with different methods to check whether a string contains a substring or not. In this article, we use the following three methods for this purpose-String search() methodString indexOf() methodString includes() methodLet’s explore in detail each method.1. String search() methodThe string search method can be used to search ... Read More

How to add a unique id for an element in HTML?

Abhinaya

Abhinaya

Updated on 24-Jun-2020 08:28:45

735 Views

Use the id attribute in HTML to add the unique id of an element.ExampleYou can try to run the following code to implement id attribute −           Tutorialspoint       We provide Tutorials!       More...                function display() {             document.getElementById("myid").innerHTML = "We provide learning videos as well";          }          

Why aren't variable-length arrays part of the C++ standard?

Abhinaya

Abhinaya

Updated on 24-Jun-2020 05:52:35

362 Views

Having to create a potential large array on the stack, which usually has only little space available, isn't good. If you know the size beforehand, you can use a static array. And if you don't know the size beforehand, you will write unsafe code. Variable-length arrays can not be included ... Read More

How to set the length of the item relative to the rest with JavaScript?

Abhinaya

Abhinaya

Updated on 23-Jun-2020 12:16:12

61 Views

Use the flex property in JavaScript to set the length of the item relative to the rest. You can try to run the following code to implement flex property with JavaScript −Example                    #box {           ... Read More

How to create JavaScript regexes using string variables?

Abhinaya

Abhinaya

Updated on 23-Jun-2020 12:07:53

88 Views

Yes, use new RegExp(pattern, flags) to achieve this in JavaScript.You can try to run the following code to implement JavaScript regex using string variables −                    var str = 'HelloWorld'.replace( new RegExp('hello', 'i'), '' );          document.write(str);          

How to set the bottom padding of an element with JavaScript?

Abhinaya

Abhinaya

Updated on 23-Jun-2020 11:21:20

477 Views

To set the bottom padding, use the paddingBottom property in JavaScript.ExampleYou can try to run the following code to return the bottom padding of an element with JavaScript −                    #box {             border: 2px ... Read More

Match any string containing zero or more p's.

Abhinaya

Abhinaya

Updated on 23-Jun-2020 08:33:40

126 Views

To match any string containing zero or more p’s with JavaScript RegExp, use the p* Quantifier.ExampleYou can try to run the following code to match any string containing zero or more p’s. Here, p is considered as a number of occurrences −           JavaScript Regular Expression ... Read More

With JavaScript RegExp search a vertical tab character.

Abhinaya

Abhinaya

Updated on 23-Jun-2020 07:50:10

203 Views

To find a vertical tab character with JavaScript Regular Expression, use the following −\vExampleYou can try to run the following code to find a vertical tab character. It returns the position where the vertical tab (\v) character is found −           JavaScript Regular Expression     ... Read More

With JavaScript how can I find the name of the web browser, with version?

Abhinaya

Abhinaya

Updated on 23-Jun-2020 07:01:42

246 Views

To find the name of the web browser, with version, you need to try the following code −Example           Browser Detection Example                                  

1 2 3 4 5 ... 7 Next
Advertisements