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 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

RequestDispatcher.forward() vs HttpServletResponse.sendRedirect()

Get Free Book šŸ™‚ RequestDispatcher.forward() vs HttpServletResponse.sendRedirect()_______________________________________________________________RequestDispatcher.forward()_______________________________________________________________ 1.When we use forward method, request is transfer to other resource within the same server. 2.client or browser is not involved. 3.When forward is called on requestdispatcher object we pass request and response Read More

Producer Consumer Problem in java

Oveririding rules

Rules for overriding The access level can’t be more restrictive than the overridden method’s.

  CompilesĀ  fine

  Not Allowed

  Not Allowed

  Output: :2 The access level CAN be less restrictive than that of Read More