Interview Questions and Answer from Core Java

Technical Interview questions from Core Java, Technical questions from variable declaration, data type operators chapter from core java


java is an Object  Oriented Programming Language. Which is mostly used to develop Windows based Software  as well as Web Based Project. It is good to have good knowledge about a programming language and practical knowledge for developing program in that particular language. In the technical interview for the post of  Java Developer some basic questions are asked. In this post I am telling about questions at basic level. 

In the Part 1 we have seen some questions from Variable, operator interfaces and jvm etc. Now in this post  questions are related to Variable, operators, JVM and Jdk, Interface and access specifier, static keyword, inner classes, data type.

                                   





Q             When can an object reference be cast to an interface reference?  
A             An object reference can be cast to an interface reference when the object implements the referenced interface.

Q             Which class is extended by all other classes?  
A             The Object class is extended by all other classes.

Q             Can an object be garbage collected while it is still reachable?  
A             A reachable object cannot be garbage collected. Only unreachable objects may be garbage collected.

Q             Is the ternary operator written x : y ? z or x ? y : z ?  
A             It is written x ? y : z.

Q             How is rounding performed under integer division?  
A             The fractional part of the result is truncated. This is known as rounding toward zero.

Q             What is the difference between the Reader/Writer class hierarchy and the InputStream/OutputStream class hierarchy?  
A             The Reader/Writer class hierarchy is character-oriented, and the InputStream/OutputStream class hierarchy is byte-oriented.

Q             What classes of exceptions may be caught by a catch clause?  
A             A catch clause can catch any exception that may be assigned to the Throwable type. This includes the Error and Exception types.

Q             If a class is declared without any access modifiers, where may the class be accessed?  
A             A class that is declared without any access modifiers is said to have package access. This means that the class can only be accessed by other classes and interfaces that are defined within the same package.

Q             Does a class inherit the constructors of its superclass?  
A             A class does not inherit constructors from any of its superclasses.

Q             What is the purpose of the System class?  
A             The purpose of the System class is to provide access to system resources.

Q             Name the eight primitive Java types.  
A             The eight primitive types are byte, char, short, int, long, float, double, and boolean.

Q             Which class should you use to obtain design information about an object?  
A             The Class class is used to obtain information about an object's design.

Q             Is "abc" a primitive value?  
A             The String literal "abc" is not a primitive value. It is a String object.

Q             What restrictions are placed on the values of each case of a switch statement?  
A             During compilation, the values of each case of a switch statement must evaluate to a value that can be promoted to an int value.

Q             What modifiers may be used with an interface declaration?  
A             An interface may be declared as public or abstract.

Q             Is a class a subclass of itself?  
A             A class is a subclass of itself.

Q             What is the difference between a while statement and a do statement?  
A             A while statement checks at the beginning of a loop to see whether the next loop iteration should occur. A do statement checks at the end of a loop to see whether the next iteration of a loop should occur. The do statement will always execute the body of a loop at least once.

Q             What modifiers can be used with a local inner class?  
A             A local inner class may be final or abstract.

Q             What is the purpose of the File class?  
A             The File class is used to create objects that provide access to the files and directories of a local file system.

Q             Can an exception be rethrown?  
A             Yes, an exception can be rethrown.

Q             When does the compiler supply a default constructor for a class?  
A             The compiler supplies a default constructor for a class if no other constructors are provided.

Q             If a method is declared as protected, where may the method be accessed?  
A             A protected method may only be accessed by classes or interfaces of the same package or by subclasses of the class in which it is declared.

Q             Which non-Unicode letter characters may be used as the first character of an identifier?  
A             The non-Unicode letter characters $ and _ may appear as the first character of an identifier

Q             What restrictions are placed on method overloading?  
A             Two methods may not have the same name and argument list but different return types.

Q             What is casting?  
A             There are two types of casting, casting between primitive numeric types and casting between object references. Casting between numeric types is used to convert larger values, such as double values, to smaller values, such as byte values. Casting between object references is used to refer to an object by a compatible class, interface, or array type reference.

Q             What is the return type of a program's main() method?  
A             A program's main() method has a void return type.

Q             What class of exceptions is generated by the Java run-time system?  
A             The Java runtime system generates RuntimeException and Error exceptions.

Q             What class allows you to read objects directly from a stream?  
A             The ObjectInputStream class supports the reading of objects from input streams.

Q             What is the difference between a field variable and a local variable?  
A             A field variable is a variable that is declared as a member of a class. A local variable is a variable that is declared local to a method.

Q             How are this() and super() used with constructors?  
A             this() is used to invoke a constructor of the same class. super() is used to invoke a superclass constructor.

Q             What is the relationship between a method's throws clause and the exceptions that can be thrown during the method's execution?  
A             A method's throws clause must declare any checked exceptions that are not caught within the body of the method.

Q             Why are the methods of the Math class static?  
A             So they can be invoked as if they are a mathematical code library.

Q             What are the legal operands of the instanceof operator?  
A             The left operand is an object reference or null value and the right operand is a class, interface, or array type.

Q             What an I/O filter?  
A             An I/O filter is an object that reads from one stream and writes to another, usually altering the data in some way as it is passed from one stream to another.

Q             If an object is garbage collected, can it become reachable again?  
A             Once an object is garbage collected, it ceases to exist. It can no longer become reachable again.

Q             What are E and PI?  
A             E is the base of the natural logarithm and PI is mathematical value pi.

Q             Are true and false keywords?  
A             The values true and false are not keywords.

Q             What is the difference between the File and RandomAccessFile classes?  
A             The File class encapsulates the files and directories of the local file system. The RandomAccessFile class provides the methods needed to directly access data contained in any part of a file.

Q             What happens when you add a double value to a String?  
A             The result is a String object.

Q             What is your platform's default character encoding?  
A             If you are running Java on English Windows platforms, it is probably Cp1252. If you are running Java on English Solaris platforms, it is most likely 8859_1.

Q             Which package is always imported by default?  
A             The java.lang package is always imported by default.

Q              What interface must an object implement before it can be written to a stream as an object?  
A             An object must implement the Serializable or Externalizable interface before it can be written to a stream as an object.

Q             What’s the difference between notify() and notifyAll()?  
A             notify() is used to unblock one waiting thread; notifyAll() is used to unblock all of them. Using notify() is preferable (for efficiency) when only one blocked thread can benefit from the change (for example, when freeing a buffer back into a pool). notifyAll() is necessary (for correctness) if multiple threads should resume (for example, when releasing a "writer" lock on a file might permit all "readers" to resume).


COMMENTS

Name

advance-java,2,advancejava,1,aktu entrance exam,1,aktu exam schedule,1,ASP,1,bare machine,1,base register and limit register,1,Basic Computer network questions,1,C Programming,15,C Plus Plus,1,C Programming,2,C Programming MCQ,2,C Programming Questions,2,C programming study material for gate exam,13,CBNST Program,1,Childcare,1,CJ,2,Cloud Computing,1,components of use case diagram,1,Computer architecture based questions for gate exam,11,Computer Network,3,Computer Network Study Material,4,Computer network study material for gate,2,Computer Networks,7,Computer Science Study Material for Gate,20,computer science study material for gate exam,37,content based image retrieval content based image retrieval system,1,contiguous memory allocation,2,Core Java,8,COre Java Interview Questions,1,core java interviews questions,1,cyber crime report,1,Cyber crime status,1,cybercrime and security,1,cybercrime examples,1,Data link Layer Questions,1,Data Mining,1,Data Structure Questions,1,Data Transmission Architecture,1,Data Transmission in wsn,1,DBMS,4,dbms question paper,1,DE,1,Different types of addressing modes,1,Digital Electronics,1,DS,1,dynamic linking,1,dynamic linking in memory management,1,Electroencephalogram,1,file concept in os,1,File Handling,1,file management in operating system,1,FOC,1,Fundamenatl of Computer,1,Gate 2017,5,Gate 2017 Admit card,1,Gate 2017 Exam Schedule,1,Gate 2017 Syllabus,1,gate 2018,1,gate cse study material,1,gate practice set,10,gate study material for computer science,19,Gate study material for computer science 2017,1,GatePreviousYear,1,General,3,HCL Aptitude Test,1,HR Interview Questions,1,HTML,1,Image Processing,1,Important Date of Gate 2017 Exam,1,Information Security Policy,1,internal and external fragmentation,1,JS,1,lagrange's interpolation formula,1,lagrange's interpolation formula examples,1,Looping in C,1,MComputing,1,memory fragmentation,1,memory management,1,Motivational,4,NCER,2,Numerical Techniques Lab,1,OOT,1,Operating System,8,Operating System Objective Questions,4,Operating System Questions Bank,1,Operating system questions for gate,1,Operating System Study material,2,operating system study material for gate exam,17,Operating system tutorial,3,ORACLE,1,page swapping,1,paged memory allocation,1,paged memory allocation in operating system,1,paging technique of memory management .paging technique,1,paging technique of memory management program in c,1,Pointer in C,5,Process based question for gate,1,Quiz on non conventional energy resources,1,Regression testing,1,relocation in memory management,1,relocation registe,1,relocation register,1,resident monitor,1,resident monitor in operating system,1,routing table,1,segmentation in memory management,1,segmentation in memory management in operating system,1,Servlet,1,session tracking,1,session tracking in java,1,session tracking in servlet,1,Software Engineering,7,Software Engineering baes study material for gate,1,software engineering interview questions,1,Software Quality Assurance,3,SPM,1,SQL,1,Structure in C,1,Study Material for gate Computer Science,11,swapping in memory management,1,swapping in operating system,1,TCS Code Vita,1,Technical Questions from DBMS,1,Threads concept in operating system,1,Tips to Learn Coding,1,Top 30 Core Java Interview Questions with Answer,2,top down approach,1,top down approach in programming,1,Types of operating system,1,UML,1,use case diagram explanation,1,website uses cookies,1,what is cookies website,1,What is process control block ?,1,Wireless Sensor Network,4,worst fit algorithm for memory allocation,1,XML,1,
ltr
item
Computer Science Junction: Interview Questions and Answer from Core Java
Interview Questions and Answer from Core Java
Technical Interview questions from Core Java, Technical questions from variable declaration, data type operators chapter from core java
https://2.bp.blogspot.com/-47dLCRAayvI/VnJVw81KAGI/AAAAAAAAAGY/NbGNSfjegVY/s320/javaq.png
https://2.bp.blogspot.com/-47dLCRAayvI/VnJVw81KAGI/AAAAAAAAAGY/NbGNSfjegVY/s72-c/javaq.png
Computer Science Junction
https://www.computersciencejunction.in/2015/12/interview-questions-from-core-java-part.html
https://www.computersciencejunction.in/
https://www.computersciencejunction.in/
https://www.computersciencejunction.in/2015/12/interview-questions-from-core-java-part.html
true
425357657003182083
UTF-8
Loaded All Posts Not found any posts VIEW ALL Readmore Reply Cancel reply Delete By Home PAGES POSTS View All RECOMMENDED FOR YOU LABEL ARCHIVE SEARCH ALL POSTS Not found any post match with your request Back Home Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec just now 1 minute ago $$1$$ minutes ago 1 hour ago $$1$$ hours ago Yesterday $$1$$ days ago $$1$$ weeks ago more than 5 weeks ago Followers Follow THIS PREMIUM CONTENT IS LOCKED STEP 1: Share. STEP 2: Click the link you shared to unlock Copy All Code Select All Code All codes were copied to your clipboard Can not copy the codes / texts, please press [CTRL]+[C] (or CMD+C with Mac) to copy