What do you want to save?
Add Code snippet
New code examples
-
Other 2022-03-05 12:05:02
overloading vs overriding
Method Overloading Method overloading is providing two separate methods in a class with the same name but different arguments, while the method return type may or may not be different, which allows us to reuse the same method name. 1) Method Overloadin... Add solution -
Other 2022-02-24 22:00:15
static vs instance
static or class method 1) A method that is declared as static is known as the static method 2) We don't need to create the objects to call the static methods 3) Non-static (instance) members cannot be accessed in static context (static method, static blo... Add solution -
Java 2021-11-16 10:04:39
how to call a void method with parameters in java
public class methods{ public static void main(String[] args){ printSum(5, 15); // Print 20 } public static void printSum(int a, int b){ System.out.println(a + b); } // Our method should be outside the main methods bounds // Call your f... Add solution -
PHP 2021-11-14 10:17:23
array_merge(): Expected parameter 1 to be an array, null given at vendor/phpunit/phpunit/phpunit:61
// PHPUnit uses the constructor for initialization of the base TestCase. // You shouldn't use the constructor, because it's used by phpunit and any // change to the signature etc can break things. You can use the special // setUp and setUpBeforeClass meth... Add solution -
Java 2021-11-08 04:00:18
static methods vs instance methods
static or class method 1) A method that is declared as static is known as the static method 2) We don't need to create the objects to call the static methods 3) Non-static (instance) members cannot be accessed in static context (static method, static blo... Add solution -
Java 2021-10-25 03:19:08
difference between overloading and overriding in java
Method Overloading Method overloading is providing two separate methods in a class with the same name but different arguments, while the method return type may or may not be different, which allows us to reuse the same method name. 1) Method Overloadin... Add solution -
Python 2021-10-22 11:45:12
call instance class python
# define class class example: # define __call__ function def __call__(self): print("It worked!") # create instance g = example() # when attempting to call instance of class it will call the __class method g() # prints It worked! Add solution