Found 9321 Articles for Object Oriented Programming

WebGL: Prevent color buffer from being cleared in HTML5

Samual Sam
Updated on 30-Jan-2020 06:53:31

111 Views

Even if removing the color by code:mycanvas.clearColor(d[1],d[2],d[3],2.0); mycanvas.clear(can.COLOR_BUFFER_BIT );The screen gets cleared at beginning of next draw cycle.To create WebGLRenderingContext, previous drawing buffer can be preserved.gl = someCanvas.getContext("webgl", { preserveDrawingBuffer: true }); The default is preserveDrawingBuffer: false by making this property true, previous drawing can be easily preserved

Java is also not pure object-oriented like c++

Pythonista
Updated on 30-Jul-2019 22:30:22

291 Views

the main() method in Java code is itself inside a class. The static keyword lets the main() method which is the entry point of execution without making an object but you need to write a class. In C++, main() is outside the class and writing class it self is not mandatory. Hence, C++ is not a pure object oriented language bu Java is a completely object oriented language.

Multiple .java files

Mohammad Mohtashim
Updated on 30-Jul-2019 22:30:22

297 Views

You can use Advanced IDE to use multiple files. Here is the link:https://www.tutorialspoint.com/online_java_compiler.php

Is there a way to add/remove several classes in one single instruction with classList in HTML and JavaScript?

Samual Sam
Updated on 24-Jun-2020 14:13:58

96 Views

The classList property returns the class name(s) of an element, as a DOMTokenList object. The classList property is read-only, however, you can modify it by using the add() and remove() methods.The classListproperty ensures that duplicate classes are not unnecessarily added to the element. In order to keep this functionality, if you dislike the longhand versions or jQuery version, I’d suggest adding addMany function and removeMany to DOMTokenListThese would then be useable like so −DOMTokenList.prototype.addMany = function(classes) {    var arr = classes.split(' ');    for (var j = 0, length = arr.length; j < length; j++) {       this.add(array[j]); ... Read More

How to write string functions in Java?

Pythonista
Updated on 30-Jul-2019 22:30:22

83 Views

1) take a string from the user and check contains atleast one digit or not:Extract character array from string using toCharArray() method. Run a for loop over each character in array and test if it is a digit by static method isDigit() of character classpublic static boolean chkdigit(String str) { char arr[]=str.toCharArray(); for (char ch:arr) { if (Character.isDigit(ch)) { return true; } } return false; }2.) take ... Read More

In JavaScript inheritance how to differentiate Object.create vs new?

Abhinanda Shri
Updated on 24-Jan-2020 10:16:54

106 Views

In the first example, you are just inheriting amitBaseClass prototype.function SomeClass() { } SomeClass.prototype = Object.create(amitBaseClass.prototype);In the second example, you are executing the constructor function. An instance of amitBaseClass is created and you are inheriting the who complete amitBaseClass object.function SomeClass () { } SomeClass.prototype = new amitBaseClass ();So, both are doing separate work.

How to perform Automated Unit Testing with JavaScript?

Chandu yadav
Updated on 24-Jun-2020 06:43:52

162 Views

To perform unit testing in JavaScript, use Unit.js. It is a cross-platform open-source unit testing framework.ExampleLet’s say the following in your test code −var example = ‘Welcome’; test.string(example) .isEqualTo(‘Welcome’);The function demo() displays a suit of tests, whereas demo1() is an individual test specification,demo('Welcome’, function() {    demo1('Welcome to the website', function() {       var example = ‘Welcome’;       test.string(example)       .isEqualTo(‘Welcome’);    }); });

How to disable browser's back button with JavaScript?

George John
Updated on 24-Jan-2020 10:16:08

3K+ Views

To disable web browsers’ back button, try to run the following code. This is the code for current HTML page,Example           Disable Browser Back Button                               Next Page               $(document).ready(function() {          function disablePrev() { window.history.forward() }          window.onload = disablePrev();          window.onpageshow = function(evt) { if (evt.persisted) disableBack() }       });     The following is the code for newpage.html,           Go to back page using web browser back button.     a

Is it safe to assume strict comparison in a JavaScript switch statement?

Priya Pallavi
Updated on 24-Jun-2020 06:44:25

99 Views

To get out of the confusion regarding strict comparison, try to run the following code snippet in JavaScript −Exampleswitch(1) {    case '1':       alert('Switch comparison: Not Strict.');       break;    case 1:       alert('Switch comparison: Strict.');       break;    default:       alert(‘Default’); }

What is JavaScript AES Encryption?

Lokesh Badavath
Updated on 21-Nov-2022 14:54:35

13K+ Views

In this article, we are going to learn what is JavaScript AES Encryption. AES is an algorithm developed for the encryption of data. AES uses the same key to encrypt and decrypt data, called the symmetric encryption algorithm. AES encryption is Advanced Encryption Standard (AES) to encrypt the data in the application. We use the JavaScript library Forge to perform AES encryption. These algorithms are used in different communication apps such as WhatsApp, Signal, etc. The third-party user cannot be able to decrypt the message, and when the message is reached the destination receiver endpoint, it is decrypted using the ... Read More

Advertisements