Posts

Showing posts from April, 2022

Angular Ionic Interview Questions

JAVASCRIPT What is hoisting? Its mechanism Variable and function declarations are moved to the top of their scope before code execution. console.log(x) //undefined var x = 10 console.log(x) // print 10 console.log(y+z) //reference error let y = 10 const z = 10 --------------------------------------------------------------------------------------------------------------------------- Difference between let and var? --------------------------------------------------------------------------------------------------------------------------- What are let, var, and const in javascript? let - block scoped, redeclared not supported in same scope const - block scoped, redeclared or redesigned are not supported var - function scoped, redeclared and redesigned are supported function scope  function test(){ var a = 10; var a = "mani";  //redeclared and redesigned are supported with the scope } block scope if(test){ let a = 10; let b = 11; //error if(tt){ let b = 12; //working } } if(test)

Android Interview Questions 2022

JAVA Why String is mutable? String str1 = 10                 String str2 = 20         str1 == str2 is this true? What String Pool in java? Difference of StringBuffer vs String? Difference of StringBuilder vs StringBuffer? What is HashMap and purpose? Difference of HashMap vs HashTable? Difference of HashMap vs HashSet? What is array vs list? What is abstract class in java? What is collections in java? What is flatmap? What is array vs arraylist? What is Interface in Java? What is polymorphism ? What is singleton class? The following variable stored in which memory?                 String str = new String()  - memory?         String str = “test”;         String str1 = “test”;            - memory? Difference of == and equals() method in java? Program: Segregate the 01 int array [0100110100] to [0000001111] Write a program for fibno series? Write a program for palindrom? Eg: 121, madam Write a program input [12345678] to output [76812345] Write a program for vowels from given string? Writ

Companion Object Vs @JvmStatic in Kotlin

 Hi guys, Now, we are going to see the difference between the companion object and @JvmStatic in kotlin. What is a companion Object in Kotlin? Kotlin language does not have static keyword like java. So, Its provide companion object {} block instead of static keyword, We can also used @JvmStatic to denote the static variable or methods. companion object is an instance of the Campanion class, So, When we call the kotlin code from java, an object of the Companion class is first instantiated behind the scenes. To understand this, let's consider a simple example. Kotlin code (Without @JvmStatic) class Car {     companion object {         fun getSeatSize() { }     } } Decompiled Java code public final class Car {    public static final Car.Companion Companion = new Car.Companion();    public static final class Companion {       public final void getSeatSize() { }       private Companion() { }    } } Java using the Car.Companion: Car.Companion.getSeatSize(); Kotlin code (With @JvmStatic)