ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
tip   To Refer this Site to Your Friends   Click Here
Google
 
Categories  >>  Software  >>  Core Java  >>  Java J2EE  >>  Java Related
 
 


 

 
 Core Java interview questions  Core Java Interview Questions
 Advanced Java interview questions  Advanced Java Interview Questions
 Swing interview questions  Swing Interview Questions
 EJB interview questions  EJB Interview Questions
 Servlets interview questions  Servlets Interview Questions
 Struts interview questions  Struts Interview Questions
 JDBC interview questions  JDBC Interview Questions
 JMS interview questions  JMS Interview Questions
 SunOne interview questions  SunOne Interview Questions
 J2EE interview questions  J2EE Interview Questions
 Weblogic interview questions  Weblogic Interview Questions
 Websphere interview questions  Websphere Interview Questions
 Java Networking interview questions  Java Networking Interview Questions
 Java J2EE AllOther interview questions  Java J2EE AllOther Interview Questions
Question
What is non static block in java
 Question Submitted By :: Srinivasa
I also faced this Question!!     Rank Answer Posted By  
 
  Re: What is non static block in java
Answer
# 1
No Non Static blocks in java
 
Is This Answer Correct ?    3 Yes 3 No
Srinivasa
 
  Re: What is non static block in java
Answer
# 2
Any Block of code written between  { and } ca be called as
non-static block in java
 
Is This Answer Correct ?    4 Yes 2 No
Anuradha
 
 
 
  Re: What is non static block in java
Answer
# 3
Non static blocks: Code within {} is non-static block
for example:

{
// code
}
 
Is This Answer Correct ?    2 Yes 2 No
Sreenu Karampudi
 
  Re: What is non static block in java
Answer
# 4
Non static block is a block which is surounded by { and }
for ex : 

{
//code goes here
}

The code within non static block is executed whenever a new
instance of that class is created.
It is instance block.
 
Is This Answer Correct ?    3 Yes 0 No
Raj_allinterview
 
  Re: What is non static block in java
Answer
# 5
class demoStaticnonstatic 
{
	int i;
	demoStaticnonstatic()//constructor
	{
		System.out.println("Under Constructor");
	}//end
	static//static block
	{
		System.out.println("Under static block");
	}//end
	//non-static block
	{
		System.out.println("Under non-static 
block");
	}//end
	public static void main(String[] args) 
	{
		System.out.println("under main method!");
		demoStaticnonstatic d=new 
demoStaticnonstatic();
	}
}
STATIC BLOCK: is used in real time senarios, it provide 
information regording the project(name.company,version etc)
before actually project executed.
NON-STATIC BLOCK:is used for - if we have many constructor 
in a application and those constructor have same statements 
instead of repeate those statement in each constructor,we 
place that statement in non-static block.
 
Is This Answer Correct ?    0 Yes 0 No
Syed
 
  Re: What is non static block in java
Answer
# 6
Instance methods are called non static blocks. Because we
can't call them without creating the object.Constructor is
also a non static block. Non Static means other than the
static block and static methods in a class . So we ca the
above two as non static block.
 
Is This Answer Correct ?    0 Yes 0 No
Srinivasa
 

 
 
 
Other Core Java Interview Questions
 
  Question Asked @ Answers
 
can u override the start() method of Thread class  4
how many ways we can serialize the java object? Satyam1
How many methods does cloneable interface contains?  2
class A{ class B{ } } in which name u save the file,its the program compile? HCL6
Name the package that most of the AWT events that supports event-delegation model are defined?  2
why the abstract class has default constructor?  1
What is the preferred size of a component?  1
What will happens if you opened Internet Explorer 4 times?  2
In what type of containers, Border layout is a default layout?  3
How to print nodes of a Binary tree? TCS1
what is the replacement for GOTO in java? CTS2
Can a lock be acquired on a class?  2
how exactly garbage collection take place?  4
Does 'true' and 'false' are keywords?  5
What is more advisable to create a thread, by implementing a Runnable interface or by extending Thread class?  5
Write a program to create a binary Tree ?  1
what is meant by serialization?  6
Howmany classes that package java.applet.* contains? TCS1
What is compile time polymorphism? Elementus-Technologies6
How can you reverse a string?  4
 
For more Core Java Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com