Powered by Blogger.

Wednesday 21 September 2022

What is your the project architecture and Process?

No comments :
My Project Architecture is divided into Three Layers.
        
  1. Presentation Layer (Client or Browser).
  2. Business Layer. (Frameworks and Logical). 
  3. Database Layer. (Like: Oracle/SQL/Mysql). 
Presentation Layer (Client or Browser): it is also known as client layer (Like UI). The main functionality of this layer is to communicate with Application layer.
Business Layer (Frameworks and Logical): It is also called business logic layer interacts with database layer and send required information to the presentation layer.
Database Layer. (Like: Oracle/SQL/Mysql):The Data is stored in the Layer. Business layer communication with database layer to retrieve insert, update, delete the data.

Project Process: When ever we submitting the request from client to server component then controller receives the request from browser . so you mast remember every request will reach to controller component.
The controller receives the request from browser then controller has to identity a particular model. then it will execute be java class or business logic's available. Hence: Here controller acts as mediator between view and the model.
After executing model part if it is required to interact with database then model part interact with data.
Then view layer display of the model to the end user. then generated the require dynamic web page return to browser. finally view part send to the response to the client.

Monday 26 September 2016

Interview Question And Answer in java

No comments :
Q.1:   Is the code compiles ? If yes then what will be the output ?
Ans.
Output :      false
                  true
Q.2: Is the code compiles ? If yes then what will be the output ?
Ans.
Output :      s1
                  s2
                  s3
                  post 
                 StringBuffer 
                 stop
Q.3: Is the code compiles ? If yes then what will be the output ?
Ans.

Output :   r10
Q4. : Is the code compiles ? If yes then what will be the output ?
Ans.

Output:          run method output: s1.equals(s2) is true
                     run1 method output: S1==S2 is True
Q.5:Is the code compiles ? If yes then what will be the output ?
Ans.

Output :   2
Q.6:Is the code compiles ? If yes then what will be the output ?
Ans.

Output :          java.lang.NullPointerException.
Q. 7: Is the code compiles ? If yes then what will be the output ?
Ans.

Output:         15
                    o Manoj
Q.8: Is the code compiles ? If yes then what will be the output ?
Ans.

Output :     Run1---: 2
                 Run2+++: 6
                 Run Main Body : 6
Q.9: Is the code compiles ? If yes then what will be the output ?
Ans.

Output :             public int
                         object
                         String
                         4

Wednesday 7 September 2016

OOPs Interview Question And Answer


Q.1- What is OOPs ?
Ans.- OOps(Object Oriented Programming System) is a Methodology to design a Program using class and Object is known as a OOps.
Q.2- What is Concepts of OOps ?
Ans.- There are following Concepts.
  1.   Object.
  2.   Class.
  3.   Inheritance.
  4.   Polymorphism.
  5.   Encapsulation.
  6.   Abstraction.

Q. 3- What is Object?
Ans.- Any Entity that has state and behavior is Called object. it can be Physical and Logical.
Q. 4- What is Class?
 Ans.- Class is Collection of object is Called Class. it is Logical Entity.
Q.5- What is Inheritance ?
Ans.- When one object Acquires all the Properties and behaviors of parent object is Called Inheritance. It provides code re-usability. it is used to achieve run-time Polymorphism.
Q.6- What is Polymorphism?
Ans.- When one Task is Performed to different way is known as a Polymorphism. in java, we  use Method Overloading and Overriding to achieve Polymorphism.
Q.7- What is Encapsulation?
Ans.-Encapsulation is the process of binding or wrapping code and data together into a single unit is Called Encapsulation. java beans is the fully of encapsulation class because all data members are private here.
Q.8- What is Abstraction?
Ans.- Abstraction is the process of Hiding internal details and showing functionality is Called Abstraction.
In java, we use abstract class and interface to achieve abstraction.
Example- Phone Call.
Q.9- Is the code compiles ? If yes then what will be the output ?


Ans.-                         Integer
                                 Object
                                  4
Q.10- Is the code compiles ? If yes then what will be the output ?
1. class is over.java

2. class is overTest.java

Ans.-       add.
Q.11- Is the code compiles ? If yes then what will be the output ?
1. class is over.java

Ans.-      I am A
              I am B
              I am c
              I am D.
Q.12- Is the code compiles ? If yes then what will be the output ?

Ans.-                     150
                             150

Saturday 3 September 2016

Logical Interview Question and Answer


Q. 1- Is the code compiles ? If yes then what will be the output ?

Output is:    3 4
Q. 2-Is the code compiles ? If yes then what will be the output ?

Output is:       null
Q. 3-Is the code compiles ? If yes then what will be the output ?

Output is:     Hello_selsinvers
Q. 4-Is the code compiles ? If yes then what will be the output ?

Output is:      1, Test App
Q. 5-Is the code compiles ? If yes then what will be the output ?

Output is:  Error in line number is 22 for java.lang.Error Then after output is C
Q. 6-Is the code compiles ? If yes then what will be the output ?

Output is:     9 7 7 7 7
Q. 7-Is the code compiles ? If yes then what will be the output ?

Output is:   Error in line number is 17 for java.lang.ArithmeticException: / by zero

Q. 8-Is the code compiles ? If yes then what will be the output ?

Output is:   1 2 1
Q. 9-Is the code compiles ? If yes then what will be the output ?

Output is:             MANOJ
                                 NOJ
Q. 10-Is the code compiles ? If yes then what will be the output ?

Output is:         2 String is Equals

Friday 26 February 2016

Interview Question and Answer

No comments :
Top 10 Java Interview Question and Answer.

What is Difference between JRE, JDK and JVM?
JRE: JRE(Java Run-time Environment) is the implementation of JVM.  
JDK: JDK (Java development Kit)is Physically exists It Contains JRE Development tools.
JVM: JVM (Java virtual machine) is an abstract machine which provides the run-time environment in which java byte code can be executed. JVM are available for Many hardware and Software platforms so JVM is platform Dependent.

 What is JIT Compiler ?
Just in-time(JIT)compiler is used to improve the performance. JIT Compiler parts of the byte code that have similar functionality at the same time and hence reduces the amount of time needed for compilation Here the term compiler refers to a translator from the instruction set of a JVM to the instruction set of a specific CPU (central processing unit).

What is class loader ? 
The class loader is a subsystem of JVM that is used to load classes and interfaces. There are many type of class loader.
  • Bootstrap Class Loader. 
  • Extension Class Loader. 
  • System Class Loader.
  • Plugin Class Loader.
Is "Empty.java" file name a valid source file name ?
       Yes, Save your java file only ".java" extension but compile it by "javac filename.java" and Run by "java filename".

Access Modifiers in java?
There are two type of Modifiers in java.
  • Access Modifiers: There are many access Modifiers such as Private, Default, Protected and Public.
    Public: A class or interface may be accessed from outside the package. Constructors, inner classes, methods and field variables may be accessed wherever their class is accessed. 
    Protected: Accessed by other classes in the same package or any sub classes of same package or different package.

    Default or No-access modifiers: Members of a class which are defined with no access modifiers are visible within the package in which they are defined.
    Private: Accessed only within the class in which they are declared.


  • Non-access Modifiers: There are many non-access modifiers such as Static, abstract, synchronized, native, volatile, transient etc.
    static : This modifier is used to specify whether a member is a class member or an instance member.

    final : It is used to restrict the further modification of a class or a method or a field.

    abstract : abstract class or abstract method must be enhanced or modified further.

    synchronized : It is used to achieve thread safeness. Only one thread can execute a method or a block which is declared as synchronized at any given time.

    Transient: Transient is basically a variables modifier that used for serialization.
      Now, what is Serialization? Serialization in Java is a mechanism that is used in 
      converting the state of an object into a byte stream. At the time of serialization, 
      if you don’t want to save the value of a particular variable in a file, then use the transient keyword.

      Syntax:  private transient <member variable>; 
                                          or                                  
                     transient private <member variable>;

        In case you define any data member as transient, it will not be serialized. 
        This is because every field marked as transient will not be serialized. You can use this transient 
        keyword to indicate the Java virtual machine (JVM) that the transient variable is not part of the 
        persistent state of an object.

    Volatile: Volatile modifier tells the compiler that the volatile variable can be changed unexpectedly by other parts of your program. Volatile variables are used in case of multi-threading program.

What is Package in java With Advantage?
A java package is a group of similar types of classes, interfaces and sub-packages. Package in java can be categorized in two form, built-in package and user-defined package.
Advantage of Package:
  • Java Package provides access protection.
  • Package is used to categorize the classes and interfaces so that they can be easily maintained.
How to compile java package?
Syntax: javac -d directory javafilename.



How to access package from another Package?
There are three ways to access the package from outside the package.
  • import package.*;
  • import package.classname;
  • fully qualified name.
How to store default value and default size in Java datatype?

DATA TYPE
DEFAULT VALUE
DEFAULT SIZE
Boolean
false
1 bit
byte
0
1 byte
char
'\u0000'
2 byte
short
0
2 byte
int
0
4 byte
float
0.0f
4 byte
long
0L
8 byte
double
0.0d
8 byte
object
null
-

Why char use 2 byte in java and what is \u0000?
"\u0000" is the lowest range of unicode system.
  •  Lowest Value: \u0000.
  • Highest Value: \uffff.

Question And Answer


Q.1- What is the difference between Exception and Error in java ?Exception and Error classes are both subclasses of the Throwable class. The Exception class is used for exceptional conditions that a user’s program should catch. The Error class defines exceptions that are not excepted to be caught by the user program.

Q.2- What is the difference between throw and throws ?
The keyword throw is used inside method body to invoke an exception and throws clause is used in method declaration (signature). In other words Throws clause in used to declare an exception and thow keyword is used to throw an exception explicitly.

Q.3- How many types of errors?
The types of errors in java are
 1. Syntax Error : Syntax errors are also called as compiler errors. 
Example: Missing of semicolon, Mismatch in opening and closing parenthesis, Misspell a keyword etc.
 2. Run time/Logical Error: Run-time errors are errors that occur while your program runs.
Examples: Divide an integer by zero.
                   Using a null object to reference an objects members.
                   Storing a value that is of incompatible data type. etc.

Q.4- why we use try and catch block in java?
Try: The try block contains a block of program statements within which an exception might occur. A try block is always followed by a catch block, which handles the exception that occurs in associated try block. A try block must followed by a Catch block or Finally block or both.
Catch: A catch block must be associated with a try block. The corresponding catch block executes if an exception of a particular type occurs within the try block. For example if an arithmetic exception occurs in try block then the statements enclosed in catch block for arithmetic exception executes.

Q.5- What is the difference between difference between doGet() and doPost()?
doGet() and doPost() are HTTP requests handled by servlet classes.
In doGet(), the parameters are appended to the URL and sent along with the header information.
This does not happen in case of doPost().
In doPost(), the parameters are sent separately.
Since most of the web servers support only a limited amount of information to be attached to the headers, the size of this header should not exceed 1024 bytes.
doPost() does not have this constraint.
Usually programmers find it difficult to choose between doGet() and doPost().
doGet() shall be used when small amount of data and insensitive data like a query has to be sent as a request.
doPost() shall be used when comparatively large amount of sensitive data has to be sent.

Q.6- What is the difference between using getSession(true) and getSession(false) methods?
getSession(true) will check whether a session already exists for the user. If yes, it will return that session object else it will create a new session object and return it.
getSession(false) will check existence of session. If session exists, then it returns the reference of that session object, if not, this methods will return null.

Q.7- What is meant by a Web Application ?
A Web application is a dynamic extension of a Web or application server.
There are two types of web applications:   
  • Presentation-oriented 
  • Service-oriented. 
A presentation-oriented Web application generates interactive web pages, which contain various types of markup language and dynamic content in response to requests. On the other hand,
A service-oriented web application implements the endpoint of a web service. In general,
A Web application can be seen as a collection of servlets installed under a specific subset of the server’s URL namespace.

Q.8- How are the JSP requests handled ?
On the arrival of a JSP request, the browser first requests a page with a .jsp extension. Then, the Web server reads the request and using the JSP compiler, the Web server converts the JSP page into a servlet class. Notice that the JSP file is compiled only on the first request of the page, or if the JSP file has changed.The generated servlet class is invoked, in order to handle the browser’s request. Once the execution of the request is over, the servlet sends a response back to the client.