Samsung Electronics Most Frequently Asked Latest Core Java Interview Questions Answers
What Are E And Pi?
E is the base of the natural logarithm and PI is mathematical value pi.
If An Object Is Garbage Collected, Can It Become Reachable Again?
Once an object is garbage collected, it ceases to exist. It can no longer become reachable again.
Can An Exception Be Rethrown?
Yes, an exception can be rethrown.
What Is The Purpose Of The File Class?
The File class is used to create objects that provide access to the files and directories of a local file system.
Is A Class Subclass Of Itself?
No. A class is not a subclass of itself.
What Modifiers May Be Used With An Interface Declaration?
An interface may be declared as public or abstract.
What Classes Of Exceptions May Be Caught By A Catch Clause?
A catch clause can catch any exception that may be assigned to the Throwable type. This includes the Error and Exception types.
What Is The Difference Between The Reader/writer Class Hierarchy And The Inputstream/outputstream Class Hierarchy?
The Reader/Writer class hierarchy is character-oriented, and the InputStream/OutputStream class hierarchy is byte-oriented.
Can An Object Be Garbage Collected While It Is Still Reachable?
A reachable object cannot be garbage collected. Only unreachable objects may be garbage collected.
What Is An Object's Lock And Which Object's Have Locks?
An object’s lock is a mechanism that is used by multiple threads to obtain synchronized access to the object. A thread may execute a synchronized method of an object only after it has acquired the object’s lock. All objects and classes have locks. A class’s lock is acquired on the class’s Class object.
How Are Commas Used In The Intialization And Iteration Parts Of A For Statement?
Commas are used to separate multiple statements within the initialization and iteration parts of a for statement.
What Must A Class Do To Implement An Interface?
It must provide all of the methods in the interface and identify the interface in its implements clause.
What Is The Difference Between Preemptive Scheduling And Time Slicing?
Under preemptive scheduling, the highest priority task executes until it enters the waiting or dead states or a higher priority task comes into existence. Under time slicing, a task executes for a predefined slice of time and then reenters the pool of ready tasks. The scheduler then determines which task should execute next, based on priority and other factors.
What Restrictions Are Placed On The Location Of A Package Statement Within A Source Code File?
A package statement must appear as the first line in a source code file (excluding blank lines and comments).
What Are Wrapped Classes?
Wrapped classes are classes that allow primitive types to be accessed as objects.
Is It Possible To Specify Multiple Jndi Names When Deploying An Ejb?
No. To achieve this you have to deploy your EJB multiple times each specifying a different JNDI name.
What Is Java And Their Uses?
Java is an object-programming language that was designed to be portable across multiple platforms and operating systems. Developed by Sun Microsystems, Java is modeled after the C++ programming language and includes special features that make it ideal for programs on the Internet. Still, you may be wondering why Java is suddenly receiving so much hype, and what possible improvements could have been made to this new language so as to push aside a well-established language such as C++.
First and foremost, Java makes it easy to put interactive graphics and other special effects on a World Wide Web page. As with any programming language, Java lets you write programs. Special Java programs, called applets, execute inside a Web page with a capacity matching that of any traditional program. Furthermore, when you run a Java applet, the remote server, Java transmits the applet to your browser across the Internet. So rather than going out to a computer store to buy software, Java applets let you download applications automatically when you need them.
What Is Hotjava?
Programmers often mention the name "HotJava" in the same breath as Java. Whereas Java is a programming language, HotJava was the first Web browser that could download and play (execute) Java applets. HotJava, created by Sun, is simply a browser, much like the Netscape Navigator or Microsoft's Internet Explorer.
Although HotJava was the first browser to support Java applets, many browsers now support or will soon support applets. Starting with Netscape Navigator 2.0, for example, you can play Java applets for many platforms (Windows 95, the Mac, and so on). Another distinguishing feature of HotJava is that unlike most browsers which are written in C/C++, the HotJava browser is written with the Java programming language.
How Can You Say Java Is Object Oriented?
Java is an object-oriented programming language which means you can use Java to develop your programs in terms of data and the methods (functions) that operate on the data. In Java, a class is a collection of the data and methods which describe an object with which your program works. Think of an object as a "thing," such as a graphics image, a dialog box, or a file.
Java applets can arrange classes in hierarchical fashion which means you can build new classes from existing classes, improving upon or extending the existing class's capabilities. Everything in Java, except for a few primitive types such as numbers, characters, and boolean (true and false) types, is an object. Java comes with an extensive set of classes that you can use in your programs. In fact, a Java applet itself is a Java class.
Why Java Is Platform Independent? Explain.
When you write and compile a Java applet, you end up with a platform-independent file called a bytecode. Like a standard program, a bytecode consists of ones and zeros. Unlike a standard program, however, the bytecode is not processor specific. In other words, the bytecode does not correspond to an Intel Pentium or a Motorola processor. Instead, after the server downloads the bytecode to your browser, special code within the browser reads and interprets the bytecode, in turn running the applet. To run the bytecode in this way, the interpreter translates the platform independent ones and zeros into ones and zeros your computer's processor understands. In other words, it maps the bytecode to ones and zeros that correspond to the current processor, such as a Pentium.
Each computer platform (Mac, Windows, and so on) can have its own Java interpreter. However, the bytecode file that the server downloads to each browser is identical. In this way, you use the same bytecode on a browser running on a Mac, a PC, or a Silicon Graphics workstation. The multi-platform bytecode file is just one aspect of Java's portability. Java's designers also took the extra effort to remove any platform dependence in the Java language. Thus, you will not find any hardware specific references in Java.
Why Java Is Secure? Explain.
A computer virus is a program written by someone who to maliciously damage the files you have stored on your disks or your computer's disk itself. To encounter a virus from across the Internet, you must download and run a program. Unfortunately, with Java applets, a remote sever downloads the applet to a browser on your system which, in turn, runs the applet. At first glance these downloaded Java applets are an ideal way for malicious programmers to create viruses. Luckily, the Java developers designed Java with networking in mind. Therefore, Java has several built-in security defenses which reduce a programmer's ability to use Java to create a virus.
First, Java applets cannot read or write local files that reside on your disk. In this way, the applet cannot store the virus on your disk or attach the virus to a file. That the applet simply cannot perform disk input and output. Second, Java applets are "blind" to your computer's memory layout. Specifically, Java applets do not have pointers to memory, and programmers cannot use this traditional back door to your computer. Third, Java cannot use memory outside its own memory space. By building these precautions into programming language itself, the Java developers have greatly impaired Java's use in creating and transmitting computer viruses.
Why Do People Says "java Is Robust"?
When people talk about code being robust, they are referring to the code's reliability. Although Java has not eliminated unreliable code, it has made writing high-quality software easier. To begin, Java eliminates many of the memory problems that are common in languages such as C and C++. Java does not support direct access to pointers to memory. As a result, a Java applet cannot corrupt your computer's memory. Also, Java performs run-time checks (while the applet is running) to make sure that all array and string references are within each items's bounds. In other programming languages, many software bugs result from the program not freeing memory that ought to be freed or freeing the same memory more than once. Java, on the other hand, performs automatic garbage collection (which releases unused memory), eliminating the program's need to free unused memory.
Next, Java is more strongly typed than C++ and requires method declarations, which reduces the potential for type-mismatch errors. Finally, Java institutes an error trapping method known as exception handling. When a program error occurs Java signals the program with an exception, which provides the program with a chance to recover from the error- and warns the user that something caused a specific operation to fail.
How Java Is Similar To C?
If you are already familiar with C/C++, you will find that Java is actually a simpler language to master. Java incorporates the basic tenets of object-oriented design, yet it eliminates some of the more complicated of the other language, such as multiple inheritance and templates. Many of the language keywords are the same or have only minor differences, which increases portability.
If you are a C programmer dreading the seemingly inevitable push toward C++, you may rejoice over Java's cleaner approach to object-oriented programming. In fact, you want to skip C++ altogether and learn Java instead. Java's manageable selection of predefined classes are both useful and easy to understand. Many of the common operations that may take you hundreds or thousands of lines of code are already done for you. For example, you can write a simple network chat program without having to know much about sockets, protocols, and other low-level network issues.
What Are E And Pi?
E is the base of the natural logarithm and PI is mathematical value pi.
If An Object Is Garbage Collected, Can It Become Reachable Again?
Once an object is garbage collected, it ceases to exist. It can no longer become reachable again.
Can An Exception Be Rethrown?
Yes, an exception can be rethrown.
What Is The Purpose Of The File Class?
The File class is used to create objects that provide access to the files and directories of a local file system.
Is A Class Subclass Of Itself?
No. A class is not a subclass of itself.
What Modifiers May Be Used With An Interface Declaration?
An interface may be declared as public or abstract.
Samsung Electronics Most Frequently Asked Latest Core Java Interview Questions Answers |
What Classes Of Exceptions May Be Caught By A Catch Clause?
A catch clause can catch any exception that may be assigned to the Throwable type. This includes the Error and Exception types.
What Is The Difference Between The Reader/writer Class Hierarchy And The Inputstream/outputstream Class Hierarchy?
The Reader/Writer class hierarchy is character-oriented, and the InputStream/OutputStream class hierarchy is byte-oriented.
Can An Object Be Garbage Collected While It Is Still Reachable?
A reachable object cannot be garbage collected. Only unreachable objects may be garbage collected.
What Is An Object's Lock And Which Object's Have Locks?
An object’s lock is a mechanism that is used by multiple threads to obtain synchronized access to the object. A thread may execute a synchronized method of an object only after it has acquired the object’s lock. All objects and classes have locks. A class’s lock is acquired on the class’s Class object.
How Are Commas Used In The Intialization And Iteration Parts Of A For Statement?
Commas are used to separate multiple statements within the initialization and iteration parts of a for statement.
What Must A Class Do To Implement An Interface?
It must provide all of the methods in the interface and identify the interface in its implements clause.
What Is The Difference Between Preemptive Scheduling And Time Slicing?
Under preemptive scheduling, the highest priority task executes until it enters the waiting or dead states or a higher priority task comes into existence. Under time slicing, a task executes for a predefined slice of time and then reenters the pool of ready tasks. The scheduler then determines which task should execute next, based on priority and other factors.
What Restrictions Are Placed On The Location Of A Package Statement Within A Source Code File?
A package statement must appear as the first line in a source code file (excluding blank lines and comments).
What Are Wrapped Classes?
Wrapped classes are classes that allow primitive types to be accessed as objects.
Is It Possible To Specify Multiple Jndi Names When Deploying An Ejb?
No. To achieve this you have to deploy your EJB multiple times each specifying a different JNDI name.
What Is Java And Their Uses?
Java is an object-programming language that was designed to be portable across multiple platforms and operating systems. Developed by Sun Microsystems, Java is modeled after the C++ programming language and includes special features that make it ideal for programs on the Internet. Still, you may be wondering why Java is suddenly receiving so much hype, and what possible improvements could have been made to this new language so as to push aside a well-established language such as C++.
First and foremost, Java makes it easy to put interactive graphics and other special effects on a World Wide Web page. As with any programming language, Java lets you write programs. Special Java programs, called applets, execute inside a Web page with a capacity matching that of any traditional program. Furthermore, when you run a Java applet, the remote server, Java transmits the applet to your browser across the Internet. So rather than going out to a computer store to buy software, Java applets let you download applications automatically when you need them.
What Is Hotjava?
Programmers often mention the name "HotJava" in the same breath as Java. Whereas Java is a programming language, HotJava was the first Web browser that could download and play (execute) Java applets. HotJava, created by Sun, is simply a browser, much like the Netscape Navigator or Microsoft's Internet Explorer.
Although HotJava was the first browser to support Java applets, many browsers now support or will soon support applets. Starting with Netscape Navigator 2.0, for example, you can play Java applets for many platforms (Windows 95, the Mac, and so on). Another distinguishing feature of HotJava is that unlike most browsers which are written in C/C++, the HotJava browser is written with the Java programming language.
How Can You Say Java Is Object Oriented?
Java is an object-oriented programming language which means you can use Java to develop your programs in terms of data and the methods (functions) that operate on the data. In Java, a class is a collection of the data and methods which describe an object with which your program works. Think of an object as a "thing," such as a graphics image, a dialog box, or a file.
Java applets can arrange classes in hierarchical fashion which means you can build new classes from existing classes, improving upon or extending the existing class's capabilities. Everything in Java, except for a few primitive types such as numbers, characters, and boolean (true and false) types, is an object. Java comes with an extensive set of classes that you can use in your programs. In fact, a Java applet itself is a Java class.
Why Java Is Platform Independent? Explain.
When you write and compile a Java applet, you end up with a platform-independent file called a bytecode. Like a standard program, a bytecode consists of ones and zeros. Unlike a standard program, however, the bytecode is not processor specific. In other words, the bytecode does not correspond to an Intel Pentium or a Motorola processor. Instead, after the server downloads the bytecode to your browser, special code within the browser reads and interprets the bytecode, in turn running the applet. To run the bytecode in this way, the interpreter translates the platform independent ones and zeros into ones and zeros your computer's processor understands. In other words, it maps the bytecode to ones and zeros that correspond to the current processor, such as a Pentium.
Each computer platform (Mac, Windows, and so on) can have its own Java interpreter. However, the bytecode file that the server downloads to each browser is identical. In this way, you use the same bytecode on a browser running on a Mac, a PC, or a Silicon Graphics workstation. The multi-platform bytecode file is just one aspect of Java's portability. Java's designers also took the extra effort to remove any platform dependence in the Java language. Thus, you will not find any hardware specific references in Java.
Why Java Is Secure? Explain.
A computer virus is a program written by someone who to maliciously damage the files you have stored on your disks or your computer's disk itself. To encounter a virus from across the Internet, you must download and run a program. Unfortunately, with Java applets, a remote sever downloads the applet to a browser on your system which, in turn, runs the applet. At first glance these downloaded Java applets are an ideal way for malicious programmers to create viruses. Luckily, the Java developers designed Java with networking in mind. Therefore, Java has several built-in security defenses which reduce a programmer's ability to use Java to create a virus.
First, Java applets cannot read or write local files that reside on your disk. In this way, the applet cannot store the virus on your disk or attach the virus to a file. That the applet simply cannot perform disk input and output. Second, Java applets are "blind" to your computer's memory layout. Specifically, Java applets do not have pointers to memory, and programmers cannot use this traditional back door to your computer. Third, Java cannot use memory outside its own memory space. By building these precautions into programming language itself, the Java developers have greatly impaired Java's use in creating and transmitting computer viruses.
Why Do People Says "java Is Robust"?
When people talk about code being robust, they are referring to the code's reliability. Although Java has not eliminated unreliable code, it has made writing high-quality software easier. To begin, Java eliminates many of the memory problems that are common in languages such as C and C++. Java does not support direct access to pointers to memory. As a result, a Java applet cannot corrupt your computer's memory. Also, Java performs run-time checks (while the applet is running) to make sure that all array and string references are within each items's bounds. In other programming languages, many software bugs result from the program not freeing memory that ought to be freed or freeing the same memory more than once. Java, on the other hand, performs automatic garbage collection (which releases unused memory), eliminating the program's need to free unused memory.
Next, Java is more strongly typed than C++ and requires method declarations, which reduces the potential for type-mismatch errors. Finally, Java institutes an error trapping method known as exception handling. When a program error occurs Java signals the program with an exception, which provides the program with a chance to recover from the error- and warns the user that something caused a specific operation to fail.
How Java Is Similar To C?
If you are already familiar with C/C++, you will find that Java is actually a simpler language to master. Java incorporates the basic tenets of object-oriented design, yet it eliminates some of the more complicated of the other language, such as multiple inheritance and templates. Many of the language keywords are the same or have only minor differences, which increases portability.
If you are a C programmer dreading the seemingly inevitable push toward C++, you may rejoice over Java's cleaner approach to object-oriented programming. In fact, you want to skip C++ altogether and learn Java instead. Java's manageable selection of predefined classes are both useful and easy to understand. Many of the common operations that may take you hundreds or thousands of lines of code are already done for you. For example, you can write a simple network chat program without having to know much about sockets, protocols, and other low-level network issues.
Post a Comment