October 19, 2018

Srikaanth

Convergys Most Frequently Asked Core Java Interview Questions Answers

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's The Difference Between Applets And Standalone Program?

Sun designed Java from the start to fit hand-in-glove on the Internet. Applets are special Java programs that execute from within a Web browser. In contrast, a Java application (an application program as opposed to an applet) does not run within a browser. As it turns out, Java applets are not much different from standalone Java application. You can start developing your Java program from either an applet or an application and cross over any time. For example, assume that you are writing a new Java-based application that is initially designed as a standalone (non-Internet) game for Mac computers. At the end of your program's development cycle, you decide that you want it to run on Web browsers. Your task to make it into a Web-based applet involves very trivial changes, and the addition of some simple HTML code. At the same time, you will find that the game will also run on computers other than Macs! The point you should remember is that Java applets run within browsers across the Web, whereas Java application programs do not.
Convergys Most Frequently Asked Core Java Interview Questions Answers
Convergys Most Frequently Asked Core Java Interview Questions Answers

Why Java Applets Are More Useful For Intranets As Compared To Internet?

An intranet is an in-house version of the Internet. An intranet uses the same technologies, software, and equipment that the Internet uses (primarily TCP/IP). Whereas the Internet has information servers miles away controlled by other organizations, your company controls the servers and client computers inside your office in an intranet. During the past year, intranets have experienced explosive popularity growth because they offer a very low cost way for companies to maintain and distribute internal information in an easy-to-use format.

Because intranets work like the Internet, Java also finds a home on company intranets. All the techniques that you will learn and, in fact the same applets that you will use for the Internet, may be applied in your intranet. You may find that Java applets will help you solve special software problems within the intranet. You can use applets to provide a friendly interface to company databases, documentation stores, equipment controls, and so on, while running on any computer from a Mac to a PC to a UNIX workstation.

How Can You Set The Applet Size?

Java applets run within their own window: Within your HTML file, you set the size of an applet window, using the <APPLET> tag's WIDTH and HEIGHT attributes. The size values you specify for each attribute are in pixels. For example, the following <APPLET> entry creates applet window that is 30 pixels tall by 100 pixels wide

<APPLET CODE=clock.class  WIDTH=100 HEIGHT=30> </APPLET>

How Can You Set An Applet's Height And Width As A Percentage?

You use the <APPLET> tag WIDTH and HEIGHT attributes to specify the pixel size of an applet window. In addition to letting you specify the applet window size in terms of pixels, many browsers let you specify the applet window's size as a percentage of the browser's window's size. You do this by specifying a percentage value for the HEIGHT and WIDTH attributes within the <APPLET> tag. For example, the following <APPLET> entry creates an applet window based on 50% of the height and 100% of the width of the browser's window

<applet code=test.class width=100% height=50%> </applet>.

What Is Codebase?

The Java applets your browser executes reside in a file with the .class extension. When you create a Web page, you can store you Java .class files in a directory which is different from the directory that contains the page's HTML files. Within the HTML <APPLET> tag, you can use the CODEBASE attribute to specify the directory within which the applet's .class files reside. The CODEBASE location can be a directory on the same computer or a directory at another computer. The CODEBASE attribute specifies (to the browser) the base URL (relative or specifies) of the directory that contain the .class files. If an <APPLET> tag does not use the CODEBASE attribute, the browser uses the current directory (the one containing the HTML file) to locate the .class files. The following <APPLET> tag directs the browser to look for the applet files in the directory called /server_a/applets.

<APPLET CODE="MyFirst.class"CODEBASE^"/server_a/applets" WIDTH=300
HEIGHT=300>.</APPLET>

What Is Appletviewer?

Most Java development environments include a special program called an appletviewer. using the appletviewer, you can execute your applet just as if it were running within a Web page displayed a browser. In most cases, the appletviewer can run your applet faster than a browser, making the appletviewer convenient for testing your applet. As you develop your applet, you will want to run it each time you add features. By using the appletviewer, you can quickly try out your applet without starting your Java-enabled Web browser. You run the appletviewer that accompanies Sun's Java Developer's Kit from the command line, specifying the name of the HTML file that contains the <APPLET> entry for applet you want to view

C:> appletviewer SomeFileName.HTML <ENTER>

Explain, Java Is Compatible With All Servers But Not All Browsers?

When a Java applet runs over a network, two sides are working. One is the server, which is responsible for maintaining and handling browser requests for the various files it controls. On the server side, a Java applet is just a file like any other file an HTTP server already handles. You do not need any special server software for Java since the real work of executing the Java applet is performed by the browser, not the server.

On the other side is the client, or browser, which request, receives, and interprets files from the server. The browser is responsible for displaying the Web page, playing sounds, running animations and. in general, determining the type of data the server is sending and handling that data accordingly.

When a Web page contains a Java applet, the page's HTML file will contain an <APPLET> entry. If the browser is Java-enabled, the browser will request the applet file from the server. The server, in turn, will send the applet's bytecode to the browser, which will start its Java interpreter to execute the code.

What Is The Program Development Process?

Depending on what development package you use to create your Java programs, will go about compiling, organizing, and testing your programs in different ways. However, the general development process is mostly the same no matter which package or platform you use.
As discussed, the end result of the Java programs development process is a bytecode file which the server downloads to the browser for interpretation and execution. When you compile your Java source file, you are creating a bytecode file. Java source-code files, on the other hand, contain the class definitions and program statements you write using the Java language. In addition to the Java source-code files, you must create a small HTML file, which the browser uses to invoke your applet.
After the compiler creates the bytecode and you create an HTML file, you can test your applet using either your browser or an appletviewer. If your applet contains errors, many Java development environments provide a debugger program that you can use to track down the errors. When you are ready to release your applet to the public, you must place the applet and a corresponding HTML file on a Web server.
Therefore, the general development cycle of a Java applet includes the creation of source-code and HTML files, compiling the source into bytecode, testing the bytecode through an appletviewer, detecting and removing any errors from the applet using a debugger and, finally, releasing the applet for use on a Web server.

https://mytecbooks.blogspot.com/2018/10/convergys-most-frequently-asked-core.html
Subscribe to get more Posts :