• Complain

Nzenwa I. U - Java Basics: An intro to Java and the Java developement [development] environment

Here you can read online Nzenwa I. U - Java Basics: An intro to Java and the Java developement [development] environment full text of the book (entire story) in english for free. Download pdf and epub, get meaning, cover and reviews about this ebook. year: 2016, publisher: Renux Prints, genre: Computer. Description of the work, (preface) as well as reviews are available. Best literature library LitArk.com created for fans of good reading and offers a wide selection of genres:

Romance novel Science fiction Adventure Detective Science History Home and family Prose Art Politics Computer Non-fiction Religion Business Children Humor

Choose a favorite category and find really read worthwhile books. Enjoy immersion in the world of imagination, feel the emotions of the characters or learn something new for yourself, make an fascinating discovery.

Nzenwa I. U Java Basics: An intro to Java and the Java developement [development] environment
  • Book:
    Java Basics: An intro to Java and the Java developement [development] environment
  • Author:
  • Publisher:
    Renux Prints
  • Genre:
  • Year:
    2016
  • Rating:
    5 / 5
  • Favourites:
    Add to favourites
  • Your mark:
    • 100
    • 1
    • 2
    • 3
    • 4
    • 5

Java Basics: An intro to Java and the Java developement [development] environment: summary, description and annotation

We offer to read an annotation, description, summary or preface (depends on what the author of the book "Java Basics: An intro to Java and the Java developement [development] environment" wrote himself). If you haven't found the necessary information about the book — write in the comments, we will try to find it.

Nzenwa I. U: author's other books


Who wrote Java Basics: An intro to Java and the Java developement [development] environment? Find out the surname, the name of the author of the book and a list of all author's works by series.

Java Basics: An intro to Java and the Java developement [development] environment — read online for free the complete book (whole text) full work

Below is the text of the book, divided by pages. System saving the place of the last page read, allows you to conveniently read the book "Java Basics: An intro to Java and the Java developement [development] environment" online for free, without having to search again every time where you left off. Put a bookmark, and you can go to the page where you finished reading at any time.

Light

Font size:

Reset

Interval:

Bookmark:

Make

Java Basics

Java can be written in regular text editors, and compile on Command Prompt or Terminal. Compilation is made by "javac", for more information please visit Oracle .


For this book, I will also explain Integrated Development Environment Eclipse 4.2.

Common Concept

Eclipse is a universal programming platform used for creation of Integrated Development Environments (IDE). This platform is built on an open source. Although Eclipse can be used as an IDE for development programs in C++, C#, and other programming languages, - its great popularity is as a Java IDE, and it comes with built-in Java support.
The term Workbench refers to the desktop development environment. Eclipse's Workbench window contains one or more perspectives. A perspective defines the initial set and layout of views in the Workbench window. Each perspective provides a set of functionality aimed at accomplishing a specific type of task or works. Perspectives control what appears in certain menus and toolbars. Examples of perspectives are Java, Debug, C++, etc.
When the Workbench is launched for the first time, the first thing you see is a dialog that allows you to select where the workspace should be located. The workspace is the directory where your work will be stored. After workspace location is chosen, a Welcome window is displayed ("Welcome to Eclipse IDE for Java Developers"). You can then close the "Welcome" and, if necessary, change the workspace. To start Java development, you should choose necessary perspective (Window | Open Perspective | Other... | Java) . In most cases, this is default perspective.
If the workspace was created before, main window opens with several views according to chosen perspective. Unnecessary windows should close. You can continue to work on previous projects, or create a new one.

Creating New Project


To create a new project, choose File | New | Project function of a main menu. Choose Java Project (Adapted menu provides short invocation: File | New | Java Project ). Now press Next button. On the next step you must type project name and then press Finish button.
All Java functions can be implemented in the context of classes only. Now you should create a new class with static main() method that is a starting point of your Java program. Choose File | New | Class function to activate Class Wizard. It allows adding a new source file, which contains a description of a class. Now you type package name and class name. The new class should be public. It must contain main() method.
Assume that package called test contains class called TestClass. The Class Wizard generates the following code:
CODE :


package test;
public class TestClass {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
}
}


Parameter of this method (String[] args) provides access to command line arguments.

What I mean is; you want to run the program via terminal/cmd, and you want to control your program with flags or give input values inline, you have to use command line arguments.


CODE :


c:\>myProgram -f arg3 arg4

As you know, arrays are zero indexed. So, the very first argument is args[0] which is myProgram . "-f" is second argument, and is saved in args[1] , so on.


Let's write a program which reads values for a and b , then returns c as a+b .
CODE :


package test;
import java.util.Scanner;
public class TestClass {
/**
* @param args
*/
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int a = scanner.nextInt();
int b = scanner.nextInt();
int c = a + b;
System.out.println(c);
}
}


For those who do not know what is import , and java.util.Scanner ;
In order to read user input for variable a , and b , you have to read from console. So, you need some predefined methods from the Class ( java.util.Scanner ). Scanner class takes one argument (System.in) . Since, you want to scan inputs on console, you have to define (System.in) .


The result is printed onto standard output device (console) using println() method of out object. This object is a static field of System class.
As you can see, automatically generated source file called TestClass.java is stored in test subfolder. You cannot modify names of files and folders manually. Source file can contain the only non-nested public class with the same name as file name. The name of package is always the same as subfolder name. If you want to modify these names, you should use Refactor | Rename... function.
New program should be launched using Run | Run (Ctrl-F11) function of main menu, or Run as | Java Application function of context menu. You can also create runtime configuration using Run | Run Cofigurations...[i/] function. Choose Java application item and then press New. Choose necessary project name and class name and press Run button. Special view called Console appears in lower part of Eclipse window. Next times you can press [i]"Run project name" button (or Ctrl-F11).
If the project was previously created on another computer, you can copy it to the folder that represents the workspace, and then import your project using the import function (File | Import... General | Existing Project into Workspace) . Import does not involve physical copying project files.

Debugging Program


Debugging is used to find and fix run-time errors. Choose Window | Open Perspective | Debug function for debugging. You can add breakpoints (Run | Toggle Line Breakpoint function, or Ctrl-Shift-B) . To run the program in debugging mode, use the Run | Debug F11 function of main menu. You can also use Step Into (F5) and Step Over (F6) functions. You can obtain values of variables in hints.
The Run | Resume function allows you to resume execution. The Run | Terminate function terminates execution.

Common Program Structure


There are no global variables in Java. That should avoid name conflicts. Neither are global functions or procedures, for that matter. There are only classes with fields (data members) and methods (member functions). A program in Java consists of one or more class definitions. One of these classes must define a method main() method, which is where the program starts running. Code of classes definition should be stored in text files with the Java extension. Class name (without extension) must match the name of a public class that defined in the file. Please keep in mind that capitalized and small letters are different.
Each class is compiled into its own file containing the binary code and Class extension. Unlike C++, this binary code is not a set of machine commands of particular processor, but so called byte code.
Compiled program can be executed on your computer only if so-called Java Virtual Machine is installed. Java Virtual Machine (JVM) is a special program, which provides interpretation of byte codes. This approach allows you to create applications that can be transferred from one operating environment (operating system, hardware platform) to another without additional recompilation. Unlike C++, Java does not provide static linking of binary code into an executable file. Linking (getting of a byte code from different files with the Class extension and interpreting of byte code) is always dynamic.

Identifiers, Keywords, Reserved Words, and Comments


Like C + +, Java language is case-sensitive.
Java source code consists of tokens. Token is a sequence of characters that have some meaning. Separators (space, tab, new line, etc.) are placed between individual tokens.
Tokens are divided into the following groups:
- keywords (reserved words)
- identifiers
- literals (explicit constants)
- operators.
A set of keywords is finite. All keywords are reserved. Keywords cannot be used as identifiers. In Java there are also reserved words that are not keywords. They generally cannot be used. These words are const and goto.

Next page
Light

Font size:

Reset

Interval:

Bookmark:

Make

Similar books «Java Basics: An intro to Java and the Java developement [development] environment»

Look at similar books to Java Basics: An intro to Java and the Java developement [development] environment. We have selected literature similar in name and meaning in the hope of providing readers with more options to find new, interesting, not yet read works.


Reviews about «Java Basics: An intro to Java and the Java developement [development] environment»

Discussion, reviews of the book Java Basics: An intro to Java and the Java developement [development] environment and just readers' own opinions. Leave your comments, write what you think about the work, its meaning or the main characters. Specify what exactly you liked and what you didn't like, and why you think so.