Count length of singly Linked List recursively

The problem i tried to solve is present in https://www.geeksforgeeks.org/find-length-of-a-linked-list-iterative-and-recursive/ If you liked this post kindly share it with your friends. To prepare for interviews I would recommend

Java interview questions part2

What is classloader When Java application starts the program it does not load all the required files at once. Rather it loads class files when required.Class loads is part of Jvm which loads when required. Types of classloader 1.bootstrap classloader 2.extension class loader 3.system class loader 4.custom class loader. How singleton design pattern can be created without creating private constructorWe…

Read More Read More

Frequently asked interview questions

Can we serialise the static membersDoes not make any sense to make static  members serializableStaic member belong to the class not the individual objects.Why use the hashmap keys as immutable objectsSince if we use mutable objects as keys at the time of storage and over the time when we change it may point to entire different location.so suppose for key…

Read More Read More

Concurrenthashmap Example

Concurrent HashMap example: Concurrent HashMap works on the principle of concurrent access of the segment of hashmap.It partially locks the map which gives better performance.See the simple example where producer keeps adding the element.  Producing the Element and pushing it in hashmap public void addValue()             {                         for(int i=0;i<100;i++)                         {                                                                         Integer intObj=new Integer(i);                                     System.out.println(Thread.currentThread().getName()+“Producing “+intObj);                                     this.st.put(intObj, intObj);                         }             } Producer Code:…

Read More Read More

How To Create Nested Class in java

InnerClass class A {             class B {                         public void print() {                                     System.out.println(“HI “);                         }             } } public class InnerClasses {             public static void main(String[] args) {                         A aObj=new A();                                                 A.B bObj=aObj.new B();                                                             bObj.print();                        } }  Inner Class2 class AOuter {             class BInner {                         public void printMe()…

Read More Read More

Difference between TRUNCATE, DELETE and DROP commands

TRUNCATE is a Data Definition Language command whereas DELETE is a Data M anipulatio Language command.  When compared with delete TRUNCATE is very fast. Because Step 1:When you perform DELETE all  data in table gets copied first in the  Tablespace with name Rollback.first  Then delete operation get performed. Benefit of delete is  after deleting the content of table if you try…

Read More Read More

Tricky Facts About views

Restrictions on Updating Data Through Views You can insert, update, and delete rows in a view, subject to the following limitations: Cool Gadgets If the view contains joins between multiple tables you can only insert and update one table in the view, and you can’t delete rows. You can’t directly modify data in views based on union queries. You can’t modify…

Read More Read More

Tricky Sql Interview Questions

Sql Mostly used queries. 1.Views CREATE OR REPLACE VIEW passStudent ASSELECT StudentId,StudentNameFROM StudentWHERE result=pass 2.GroupBy ClauseStudent Tablecreate table student(studId number(5),studName varchar2(10),marks number(3));   insert into student values(1,’sur’,30);    insert into student values(2,’jit’,65);  alter table student add(collegeId number(3)); SQL> update student set collegeId=1 where studId=1;    SQL> update student set collegeId=2 where studId=2;  SQL> insert into student values(3,’ramesh’,45,1);    Question select collegeId,count(collegeId) from student group by collegeId;                           COLLEGEID COUNT(COLLEGEID)                                              …

Read More Read More