Java Part 3


SUBMITTED BY: ankit007goel

DATE: July 20, 2016, 12:29 p.m.

FORMAT: Text only

SIZE: 10.3 kB

HITS: 11387

  1. Can we pass a primitive type by reference in java? - Java
  2. Primitive types can be passed by reference. 1. By storing the primitive type value in an array of single element and passing it...
  3. What do you mean by the term signature in java?
  4. A signature in java is a combination of elements in a list such as constructor and methods thereby distinguishing them from other constructors and methods...
  5. Static nested class vs. a non-static one - Java
  6. A static nested class can not directly access non-static methods or fields of an instance of its enclosing class...
  7. When we should make an instance variable private - Java
  8. An instance variable can be declared as private to promote information hiding. So that no other object can access them...
  9. Overridden methods in Java
  10. Overridden methods of super class in subclass allow a class to inherit and behave close enough...
  11. Is C++ access specifier called protected is similar to Java’s?
  12. The java access specifier ‘protected’ is placed proceeding the member of the class and the access control is applicable only for that particular definition...
  13. Why should we catch super class exceptions?
  14. Every exception is represented by the instance of Throwable or its subclasses. An object can carry the information for the exception raising point to the exception handler which catches it...
  15. Why would we manually throw an exception?
  16. When an exception is to be handled which are not java class library, a user defined exception can be thrown...
  17. What is chained exceptions in java?
  18. Once an application finds an exception, responds an exception by throwing another exception. It causes another exception. Knowing an exception that causes another exception is very useful...
  19. When should we create our own custom exception classes? - Java
  20. The term exception lets the programmer to know that there is something exceptional has occurred in the program. Apart from Java exception class library, a custom exception can be created by the developer...
  21. What are primitive type wrappers classes? - Java
  22. Primitive type wrapper classes or simply wrapper classes are available in java.lang package for providing object methods for all the eight primitive types. All the wrapper class objects are immutable...
  23. Why do you recommend that the main thread be the last to finish? - Java
  24. In an application, a program continues to run until all of the threads have ended. Hence, the main thread to finish at last is not a requirement. It is a good programming practice to make it to run last to finish...
  25. Why does Java have two ways to create child threads?
  26. Java threads can be created graciously in two ways: implementing the Runnable interface and extending Thread class...
  27. Tips on effectively using Multithreading - Java
  28. In multiple processor systems, a large algorithm will split the process into threads. So that different processors can handle different threads...
  29. Enumerations vs final variables in java
  30. Enumeration is type safe. Where as final variables are not. Enumeration supports to have a blend of various values. Where as final variables does not support multiple values...
  31. Output to an applet’s window - Java
  32. Yes it is possible for a method other than paint() or update() to output an applet’s window. It is mandatory to obtain a graphics context by invoking getGraphics() method...
  33. What is byte code? - Java
  34. The compiled Java source code is known as byte code. Java compiler generates the byte code...
  35. Range and behavior of its primitive types - Java
  36. Java strictly specifies the ranges for primitive values. The selection of values in integer or floating point types differs based on the requirement of an application...
  37. What is Java’s character type?
  38. The char data type in Java is a single 16-bit Unicode character. It represents a character that could be any one of the world languages...
  39. Difference between the prefix and postfix forms - Java
  40. The prefix operator ++ adds one to its operand / variable and returns the value before it is assigned to the variable. In other words, the increment takes place first and the assignment next...
  41. String methods indexOf() and lastIndexOf() - Java
  42. The method indexOf() returns the first occurrence (index) of a given character or a combination as parameter in a given string...
  43. Difference between protected and default access - Java
  44. The default access specifier is one which is not specified with a key word. If no access specifier (any one of private, protected, public) is mentioned it is known as the default access specifier...
  45. Ways that the members of a package can be used by other packages - Java
  46. There are two ways of affecting access levels. One, when the classes in the Java platform are used within the developer defined classes, the access levels determine the members of those class which can be used by the developer defined classes...
  47. Explain Java’s delegation event model - Java
  48. The event model is based on the Event Source and Event Listeners. Event Listener is an object that receives the messages / events. The Event Source is any object which creates the message / event...
  49. Describe the assert keyword - Java
  50. The programmer assumes certain code while developing when handling exceptions. For example, a number is passed as parameter to a method and it is to be validated whether it is positive...
  51. Why a native method might be useful? - Java
  52. Java Native methods are useful when an application can not be written completely in Java language. For instance, when a Java application needs to modify an existing application which was developed in another language...
  53. Use of shift operator in Java
  54. Using shift operators in Java we can 1. Integer division and multiplication is done faster...
  55. Need of wrappers like Integer, Boolean for int, boolean - Java
  56. Wrapper classes are used to represent primitive data types as objects. Dealing primitive types as objects is sometimes easier....
  57. Array vs ArrayList vs LinkedList vs Vector in java
  58. Array vs ArrayList: ArrayList is much better than Array, when the size need to be increased dynamically. Efficiency is possible with arrays. ArrayList permits null elements...
  59. Define Autoboxing with an example
  60. The automatic conversion of primitive int type into a wrapper class object is called autoboxing. It does not require to type cast the int value. The modification of primitive wrapper objects is done directly...
  61. Can Java communicate with ActiveX objects? - Java
  62. Java can communicate with ActiveX objects by using Bridge2Java from IBM. Bridge2Java is a tool for allowing the java applications for communicating with ActiveX objects...
  63. What is CLASSPATH variable? What is default classpath? - Java
  64. CLASSPATH is an environment variable that communicates JVM and other java applications for finding the java language class libraries, including the developer’s class library. It is set by setenv command like...
  65. Explain how to convert any Java Object into byte array? - Java
  66. 1. Create an object of ByteArrayOutputStream class. ByteArrayOutputStream bStream = new ByteArrayOutputStream();..
  67. Explain how to convert bytes[] into File object - Java
  68. 1. Create a File object. File file = new File(“path and file name here”);...
  69. JavaSpaces technology vs. database - Java
  70. Java spaces is a technology with powerful high-level tool for the development of distributed and collaborative applications. A simple API is provided based on the network shared space for developing sophisticated distributed applications...
  71. Methods for accessing system properties about the Java virtual machine
  72. The system properties are accessed by the method System.getProperties(). This method returns a Properties object...
  73. Difference between add() and addElement() in Vector - Java
  74. The add() methods inserts an element at a given position of the vector...
  75. What is difference between sets and lists? - Java
  76. Sets can have unique values. Lists can have duplicate values...
  77. What is fail-fast iterator in Java? What is it used for?
  78. The unsynchronized collections and their modifications, iterations are termed as ‘fail-fast’ iterators. An iterator that implements Iterable interface...
  79. How to store and retrieve serialized objects to and from a file in Java?
  80. The object’s current state can be persisted and retrieved by using the concept known as ‘serialization’. This is done on an object to a stream...
  81. What is relation between JAXP and Xerces? - Java
  82. Xerces is a group of libraries for parsing, serializing, validating and manipulating XML...
  83. What type of garbage collection does a System.gc() do? - Java
  84. Among various types of garbage collections, the System.gc() performs an explicit collection of garbage calls. The other garbage collection types are:...
  85. When do I need to use reflection feature in Java?
  86. Reflection feature in java allows an executing java program for introspecting upon itself. It also allows for manipulating internal properties of the program...
  87. Explain how to measure time in nanoseconds - Java
  88. Time is measured in nanoseconds by using the method nanoTime() method. This method returns the current value of the most precise system timer available in nanoseconds...
  89. Java Thread: run() vs start() method
  90. The method start() invokes the run() method. If the run() method of two threads invoked separately, they will execute one after the other...
  91. What is Java Isolates and why do we need it?
  92. Java Isolates is an API. It provides a mechanism to manage Java application life cycles which are isolated from each other. They can potentially share the underlying implementation resources...
  93. What are the system properties that applets are allowed to read by default?
  94. The following are the system properties that Java applets read by default with System.getProperty() method:...
  95. What is jvmstat?
  96. The jvmstat is a technology for adding light weight performance, configuration instrumentation to the HotSpot JVM. The jvmstat provides...
  97. Describe how to implement singleton design pattern in struts
  98. A singleton implementation is done using action class in struts framework. It performs as a front controller and every request will go through it...
  99. Difference between length and length()? - Java
  100. The ‘length’ is an instance constant which is the size of an array. While the ‘length()’ is a method that returns the no. of the characters in a string...

comments powered by Disqus