These questions are based upon concept of How Garbage collection worksDifferent kinds of Garbage collector and JVM parameters used for garbage collection monitoring and tuning. One more thing which is getting very important is ability to comprehend and understand Garbage collection Output, more and more interviewer are checking whether candidate can understand GC output or not. During Java interview they may provide a snippet of GC output and ask various questions based on that e. Which Garbage collector is used, whether output is from major collection or minor collection, How much memory is free from GC, What is size of new generation and old generation after GC etc.
It is certainly very different from the graphical user interfaces that most people are used to. However, it takes only a little practice to learn the basics of the command line environment and to become productive using it.
To use a command line programming environment, you will have to open a window where you can type in commands. In Windows, you can open such a command window by running the program named cmd. In Linux, there are several possibilities, including an old program called xterm; try looking for "Terminal" in your applications menu.
No matter what type of computer you are using, when you open a command window, it will display a prompt of some sort. Type in a command at the prompt and press return. The computer will carry out the command, displaying any output in the command window, and will then redisplay the prompt so that you can type another command.
One of the central concepts in the command line environment is the current directory which contains files that can be used by the commands that you type.
The words "directory" and "folder" mean the same thing. Often, the name of the current directory is part of the command prompt. When the window first opens, the current directory is your home directory, where all your files are stored.
You can change the current directory using the cd command with the name of the directory that you want to use. You should create a directory that is, a folder to hold your Java work.
For example, create a directory named javawork in your home directory. When you want to work on programming, open a command window and use the cd command to change into your work directory.
Of course, you can have more than one working directory for your Java work; you can organize your files any way you like. The most basic commands for using Java on the command line are javac and java; javac is used to compile Java source code, and java is used to run Java stand-alone applications.
If a JDK is correctly installed on your computer, it should recognize these commands when you type them in on the command line. If you get a message such as "Command not found," then Java is not correctly installed.
If the "java" command works, but "javac" does not, it means that a Java Runtime is installed rather than a Development Kit.
See the JDK installation instructions on Oracle's download site for information about how to do this. To test the javac command, place a copy of TextIO.
If you downloaded the Web site of this book, you can find it in the directory named source; you can use your computer's GUI to copy-and-paste this file into your working directory.
Alternatively, you can navigate to TextIO. Note that if the command succeeds, you will not get any response from the computer; it will just redisplay the command prompt to tell you it's ready for another command.
To test the java command, copy a sample program such as Interest2. First, compile the program with the command javac Interest2. Then you can execute the program using the command java Interest2 Be careful to use just the name of the program, Interest2, with the java command, not the name of the Java source code file or the name of the compiled class file.
When you give this command, the program will run. You will be asked to enter some information, and you will respond by typing your answers into the command window, pressing return at the end of the line.
When the program ends, you will see the command prompt, and you can enter another command. You can follow a similar procedure to run all of the examples in this book.
Some examples require additional classes, such as TextIO, in addition to the main program. Remember to place any required classes in the same folder as the program that uses them.
You can use either the. To create your own programs, you will need a text editor.
A text editor is a computer program that allows you to create and save documents that contain plain text. It is important that the documents be saved as plain text, that is without any special encoding or formatting information.
Word processor documents are not appropriate, unless you can get your word processor to save as plain text. A good text editor can make programming a lot more pleasant. Linux comes with several text editors. On Windows, you can use notepad in a pinch, but you will probably want something better.an iso certified & msme registered computer training & coaching institute.
Objective – Given three sides of triangle, write a program to find the area of a triangle.. Heron’s Formula for finding area of triangle: First find the semi parameter of a triangle using formula, s= (a+b+c)/2 where a, b, c are three sides of triangle and s will the semi parameter. Then use the below formula to get the area of triangle.
Java Program To Find Area Of Isosceles Triangle in Java Programs 0 Java program to find the area of an Isosceles triangle or to calculate the area of an isosceles triangle.
In this example, we will discuss how to calculate an area of a triangle by taking user input (entered by the user) using scanner() class. The leslutinsduphoenix.comr class is a simple text scanner which can parse primitive types and strings using regular expressions.
simply you can read input from the user using scanner class. Notes: A triangle is a polygon with three edges and three vertices. It is one of the basic shapes in geometry. Tags. Calculate Area Of Triangle, Java. 1) Program 1: Prompt user for base-width and height of triangle.
2) Program 2: No user interaction: Width and height are specified in the program itself. Program 1: /** * @author: leslutinsduphoenix.com * @description: Program to Calculate area of Triangle in Java * with user interaction.