GeekInterview.com
Series: Subject: Topic:
Question: 17 of 19

TCS Java Interview Questions

1. Explain the meaning of Abstract classes, abstract methods
2. What is the difference between Java and C++
3. What is the difference between == and equals method
4. Explain Java security model
5. Explain working of Java Virtual Machine (JVM)
6. What is the difference Java Beans and Servlets
7. What is the difference between AWT and Swing
8. What are the disadvantages of Java
9. What is BYTE Code ?
10. What gives java it's "write once and run anywhere" nature?
11. Does Java have "goto"?
12. What is the meaning of "final" keyword?
13. Can I create final executable from Java?
14. Explain Garbage collection mechanism in Java
15. Why Java is not 100% pure object oriented language?
16. What are interfaces? or How to support multiple inhertance in Java?
17. How to use C++ code in Java Program?
18. What is the difference between "APPLET" and "APPLICATION"
Asked by: Interview Candidate | Asked on: Sep 15th, 2005
Showing Answers 1 - 25 of 25 Answers
amudha J

Answered On : Jan 3rd, 2006

I think this questions are very very important questions.and basic question is difference between c++ and java and useful for all IT Students

  
Login to rate this answer.
varun

Answered On : Feb 9th, 2006

Firstly garbage are the variables which are no more needed in the code...but occupying the memory space.once we declare a variable it got a place in the memory, in general like in c, c++ when you don't need that variable outside the particular block,you need to allocate the memory space which it was occupying...but in java this is provided automatically by java run time environment....the whole allocation and deallocation process is called garbage collection.Java is more secure because all other programs(c,c++) are run by operating system.means they have direct access to system resources but in java it has to ask JVM to access that resources means indirect access...so more secure..
Ans 9. Byte code is actually highly optimized set of Instructions which r compiled by Java run time environment(JVM)they are not compiled but interpreted.JIT compilers r there supporting java hotspot tech to convert byte code into executable code.but piece by piece on demand bases.
Ans18. Applet is a intelligent java prog, which react to the user input.the basic diff b/w java applet and application is that applet has no main() in its code but java application have this.
Ans5.JVM is used to convert Byte codes into executable codes.JIT  compiler is also a part of this.Actually not whole of the code is get converted, that is not possible because there is a lot of checking is there in run time. so only a req part is get converted by jit compilers.

Yes  2 Users have rated as useful.
  
Login to rate this answer.
Varsha Singh

Answered On : Feb 27th, 2006

Final keyword is used to prevent its contents from being modified. This means that the one must initialize a FINAL variable when it is declared.Variables declare as final do not occupy memory on per-instance basis. Thus, a Final variable is essentially a constant. 

  
Login to rate this answer.
chandra sekhar jonnalagadda

Answered On : Mar 6th, 2006

Hi Friends,   Very very important interview questions in java basics above questions is enough for fresh interviews I think.

  
Login to rate this answer.

1. Explain the meaning of Abstract classes, abstract methods    The abstract method means the method which dose not provide the implementaion..it end with X(); instead of X(){}.The concrete class has to rpovide the implemenation for this method.Any class having atleast one such method ned to be declared as Abstract which means the object can not be created by this class.even if developer want user  not to create the objet out of his class then he can simply mark class as abstract which is not having any abstract method in it.2. What is the difference between Java and C++ver big question some key things are pointers,size of basic data types,multiple inheritnace,Array as a object,Garbage Collector,the conditonal expression for while,do-while,for,if loop must evaluates to Boolean value,package centric,etc..3. What is the difference between == and equals methodwhen we compare tow objects with == the the o/p is true only  if both the references points to same object...the equals() methods implimeted in java.lang.object is also having same implementation that is why wrapper classes ,string,stringBuffer has overidden it.for collections two different object should be meaningfully eual that is what excepted.11. Does Java have "goto"?java has goto as keyword but if used flashes compile time error.

  
Login to rate this answer.
Lalitha Prakash

Answered On : Mar 17th, 2006

Ans to Q.No. 7 -> AWT uses heavy weight components for user interface and swing uses light weight components. -> Implementation of AWT components uses native code which might vary from one machine to another. So these components might look different on different machines. But Swing components use pure Java code so the implementation and presentation of these components is the same across different machines.-> Swing is faster than AWTAns. to Q.No 12-> final variable means it is constant. The value cannot be changed-> final method means it cannot be overridden-> final class means it cannot be extended

  
Login to rate this answer.
sudha

Answered On : May 22nd, 2006

1.A class which cant be instansiated is an abstract class.abstract method is a method which dont have implementation.if a class has 1 abstract method then we have to declare class as abstract.11.yes,java supports "goto".12.final is a keyword which implies it cant be modified.final variable-cant change the variablefinal method-cant overridefinal class-cant extend.16.Interface is purly abstract class.all the variables in interface r static final by default n all the methods r abstract by default.Java supports Multiple inheritence by Interfaces.

  
Login to rate this answer.
Suresh Reddy.A

Answered On : Jul 27th, 2006

Hi This is very easy method to gain knowledge. Thank you

  
Login to rate this answer.
Dinesh patil

Answered On : Jul 28th, 2006

hi guy's someone wrote that swing is faster than AWT but i do not agree because swing uses JRE to run it takes some extra time that's why swing is little bit less faster than AWT 

  
Login to rate this answer.
kishore

Answered On : Jul 29th, 2006

HI Thank you for your answers to solve my doubts in some of the questions

  
Login to rate this answer.
saumendra11

Answered On : Aug 16th, 2006

1. Explain the meaning of Abstract classes, abstract methodsAns:-Abstract class is a class which contain (may be )both concrete method & abstract methods.but abstract methods contain no body.2. What is the difference between Java and C++ans:- everything present in java whinin class .but in c++ main method is outside of class.there is no operator overloading ,template, in java .3. What is the difference between == and equals methodAns:- we over ride  equals method & provide own functionality.4. Explain Java security modelthere  is  4 phase  security model, 1.classloader 2. classfile verifier, 3.jvm 4.java security manager& java Api.5. Explain working of Java Virtual Machine (JVM)Ans:-it is responsible for loading & executing our class.6. What is the difference Java Beans and ServletsAns:-java bean is componet.servlet is appilication7. What is the difference between AWT and SwingAns:-awt use compnet of o.s. but swing  use its own componet.thats way awt is heavy weight process & swing is light process8. What are the disadvantages of JavaAns:execution speed is  slow.9. What is BYTE Code ?Ans:-in java each instruction take one byte. 10. What gives java it's "write once and run anywhere" nature?Ans:-because compile code of one o.s is execute in another o.s11. Does Java have "goto"?Ans:-no12. What is the meaning of "final" keyword?Ans:-we can not alter the value .13. Can I create final executable from Java?Ans:no14. Explain Garbage collection mechanism in JavaAns:-it is done by two ways by reference count  & trace a graph of object reference15. Why Java is not 100% pure object oriented language?Ans:-because we can access static member by class name.16. What are interfaces? or How to support multiple inhertance in Java?Ans:-reference contain only abstract fun. by interface we can support m.i concept.17. How to use C++ code in Java Program?Ans:-by native method.18. What is the difference between "APPLET" and "APPLICATIONAns:-applet run over  browser But application   on command promt

  
Login to rate this answer.
surendran

Answered On : Aug 25th, 2006

The disadvantage in Java is that it consumes a lot of resources thus making higher demand of hardware. For n different programs compiled simultaneously causes n different JVMs.

  
Login to rate this answer.
umesh ram sharma

Answered On : Sep 3rd, 2006

ans.2  and 4)  the main diff. between c++ and jav is POINTER. this the point which make java as perfect oop and more secure.in c++ pointer give access of operating system resources bt in java, program run through jvm. c++ can't be said as perfect oop because with pointer we can find the address of object of class. then by using litle programing one can find how many elment in class and what are their type.bt in java one can restrict the user to use of functionality of class.and this absense of pointers is the piller of java security.

  
Login to rate this answer.
Sooraj Prabhakaran

Answered On : Sep 16th, 2006

Very Thanks  To All of Us .... It will realy help freshers.......

  
Login to rate this answer.
Guest

Answered On : Jan 23rd, 2007

Ans12: 'final' which cant be further changed    final primitive data memebers cant be changed  once they r assingned..we can consider it as constans.A 'final' class cant be subclassed...A 'final'  method cannot be overridden by subclasses.A 'final' variable is a constant.

  
Login to rate this answer.
Bijoy Kumar Baral,Orissa,Puri

Answered On : May 21st, 2007

1. Explain the meaning of Abstract classes, abstract methodsAns : i.A programmer uses an abstract class when some of the features shared by all the objects.ii.We can't create an object to abstarct class ,but we can get an reference to it.iii.Abstract method is the methods ,whose implementations is differed to sub classes.2. What is the difference between Java and C++?Ans:i.Byte code instructions.ii.We are not using goto statement in java.3. What is the difference between == and equals method?Ans:i.programmer uses eqal() method in order to compare the characters in two different strings. ii.A programmer uses == operator in order to compare two different strings as a whole.4. Explain Java security model?Ans: Achieve through JAAS.5. Explain working of Java Virtual Machine (JVM)?Ans:i.In the first layer:Class loader subsystem points to class file,which points to 2nd layer.ii.2nd layer consisting of 5 different parts:a.Java stacks,b.Heap,c.PC Register,d.______,e._______.which points to 3rd layer consisting of JIT compiler.6. What is the difference Java Beans and ServletsAns:Not answer now.Good questions.7. What is the difference between AWT and SwingNot working on Swing8. What are the disadvantages of JavaAns:i.Security.ii.Not support multiple inheritance9. What is BYTE Code ?Ans:User defined code converted to Bytecode instruction and is only understood by JVM10. What gives java it's "write once and run anywhere" nature?Ans:Platform independent11. Does Java have "goto"?Ans:Not allowed.12. What is the meaning of "final" keyword?Ans:i.If we use in front of a variable it represents a constants.ii.If i'm using in front of a method it can't be overridden.13. Can I create final executable from Java?Ans:No14. Explain Garbage collection mechanism in Java?Ans:If an object is no longer used in a class,then this object is considered as useless object,so these objects are held by a mechanism,called garbage collection,we provide gc() method for this purpose.15. Why Java is not 100% pure object oriented language?Ans: As we accessing data members by its class name16. What are interfaces? or How to support multiple inheritance in Java?Ans: A n interface is specification of method prototype programmer uses an interface when all the features shared by all the objects differently,we can't create an object to interface,but we can create an reference to it.17. How to use C++ code in Java Program?Ans: Not used yet18. What is the difference between "APPLET" and "APPLICATION"?i.Applet is browser specific.But Apllication is Stand aloneii.An Applet is an small foot print java program that has the capcity of travelling from one machine to another machine over Internet.But an application is a program that is run in a single machine.

  
Login to rate this answer.
Nitin

Answered On : Jun 18th, 2007

Ans of 4 - Java provides three main models 4 security, byte code verifier, class loader and security manager.
i. When each time class is loaded in memory, byte code verifier must verify it and then execute. For example suppose someone is uses the byte level editor with one file and tries
to modify the byte on file to which he don't have permission to modify. In this case byte code verifier detects this and stop the execution.
ii. Class loader as name indicates loads the class in memory 4 execution. It keeps the all local classes and network downloaded classes in different namespace. Also downloads the classes from different networks and keeps them apart.
iii.The final and important security feature is security manager. Each and every task that need execution must go through the security manager
and on the permission takes a decision whether to execute or not.

  
Login to rate this answer.
ravichandran

Answered On : Jul 19th, 2007

They asked for 2+ years exp in Java difference between vector array list 2. Meaning of clonable(); 3. Meaning of web container 4. Mean of Servlet 5. req.getParameter(); Write a program by using passing vector to a parameter to a method Print the elements in a vector? 6. What is httpservletrequest, httpservletresponse 7. Many questions in Collections

  
Login to rate this answer.
ravichandran

Answered On : Jul 19th, 2007

1. What have you learnt recently new things? 2. Explain the flow of your project? 3. Difference abstract vs inerface 4. Meaning of final? 5. Final abstract class extended or not 6. OOPS Concept 7. Write a program by using encapsulation, polymormism 8. Overriding, Overloading 9. Whats the public static void main(Integer []i) Compiles or not Whats is the o/p public static void main(Integer []i) { } public static void main(String []ar) { } That the two main method compile or not?

  
Login to rate this answer.

Q 1: Explain the meaning of Abstract classes, abstract methodsA 1: Abstract Methods: are the methods which have return type, parameters but method body is not defined, they do not define what a method does, thus they are prefixed with the keyword "abstract". ex. void add(int a , int b)      Abstract Classes: IF in any concrete or normal class they is  any method which is    declared abstract then whole class has to be declared as an Abstract Class.Though it can have other concrete classes too. Any other class extending some Abstract class and not providing the definition of super class's Abstract Method, must be also declared as abstract.Q 1: What is the difference between Java and C++ ?A 1: There are many grounds on which Java differ from C++ to name a few : Pointers, Multiple inheritence, Java uses Byte Code. Though in Java we can use C++ code using Native.

  
Login to rate this answer.
diton.online

Answered On : Nov 29th, 2008

View all answers by diton.online

9.public static void main(Integer []i){}it will compile.But will give runtime error "Exception in thread"public static void main(Integer []i){}public static void main(String []ar){} it will compile.and it will run.at run time it gives the output of the public static void main(String []ar){} method.

  
Login to rate this answer.
satyakala12007

Answered On : Jul 26th, 2009

View all answers by satyakala12007

Abstract Class means an empty implementation of all methods.

  
Login to rate this answer.
lieutaryan

Answered On : Feb 13th, 2010

View all answers by lieutaryan

We often describe security as one of the key attributes that make Java technology a superior programming environment. There are features of the language, virtual machine, and core class libraries that facilitate the creation of secure applications. While certain aspects of Java technology-related security are unavoidable for instance, you can never do pointer arithmetic, it is not an all-or-nothing deal.

  
Login to rate this answer.
Gaurav

Answered On : Sep 24th, 2011

Awt works with OS.while swing does not work with OS.

  
Login to rate this answer.

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

Related Open Questions

Ads

Connect

twitter fb Linkedin GPlus RSS

Ads

Interview Question

 Ask Interview Question?

 

Latest Questions

Interview & Career Tips

Get invaluable Interview and Career Tips delivered directly to your inbox. Get your news alert set up today, Once you confirm your Email subscription, you will be able to download Job Inteview Questions Ebook . Please contact me if you there is any issue with the download.