Friday, 2020-02-28
BioInfo Pakistan
Site menu
Section categories
JAVA Online Course [6]
This Category Is To Support Our First Free Online JAVA Course.
Our poll
Pakistani Student
Total of answers: 0
Chat Box

Total online: 1
Guests: 1
Users: 0
Home » 2011 » September » 2 » Lecture 1
12:06 PM
Lecture 1

Lecture 1
Java Programming Basics

1. General Overview
   Hello all members I welcome you all to first class. As I expect all of you as beginners to programming, so, I will try to start from grass root level. I assure you all be consistent during this course and after this course you will be good programmers.

   I hope that all of you have installed JAVA and Netbeans IDE. Today, I am starting with basics of java programming language.

   Hey, friends don't be afraid of theory in this class because me too hate it very much. But too some extent some keywords are important to be described that's why today I am explaining them.

2. Making Your First Project
Lets make first java project using Netbeans IDE. Follow these simple steps:
  1. Open Netbeans IDE.
  2. Click on File.
  3. Select New Project.
  4. Set Project Category as JAVA and choose project as JAVA Application.
  5. Set project name as HelloWorld and leave other options as it is.
  6. Click Finish.
You have made your first project. Now you can code in it.

3. Looking At the Infamous Hello, World! Program
  1. Replace // TODO code application logic here With System.out.println("Hello,World");
  2. Now press F6 or Play button in second menu bar.
  3. Result: Hello, World will be visible at the bottom.
  4. Image below showing all three steps.
   Later in this chapter, you discover in detail all the elements that make up this program. But first, I want to walk you through it word by word.

  • public: A keyword of the Java language that indicates that the element that follows should be made available to other Java elements. In this case, what follows is a class named HelloApp. As a result, this keyword indicates that the HelloApp class is a public class, which means other classes can use it.
  • class: Another Java keyword that indicates that the element being defined here is a class. All Java programs are made up of one or more classes. A class definition contains code that defines the behavior of the objects created and used by the program. Although most realworld programs consist of more than one class.
  • HelloApp: An identifier that provides the name for the class being defined here. While keywords, such as public and class, are words that are defined by the Java programming language, identifiers are words that you create to provide names for various elements you use in your program. In this case, the identifier HelloApp provides a name for the public class being defined here. (Although identifier is the technically correct term, sometimes identifiers are called symbols or names.)
  • {: The opening brace marks the beginning of the body of the class. The end of the body is marked by the closing brace. Everything that appears within these braces belongs to the class.
  • public: The public keyword is used again, this time to indicate that a method being declared here should have public access. That means classes other than the HelloApp class can use it. All Java programs must have at least one class that declares a public method named main. The main method contains the statements that are executed when you run the program.
  • static: For now, just take my word that the Java language requires that you specify static when you declare the main method.
  • void: In Java, a method is a unit of code that can calculate and return a value. For example, you could create a method that calculates a sales total. Then, the sales total would be the return value of the method. If a method doesn’t need to return a value, you must use the void keyword to indicate that no value is returned. Because Java requires that the main method not return a value, you must specify void when you declare the main method.
  • main: Finally, the identifier that provides the name for this method.As I’ve already mentioned, Java requires that this method be named main. Besides the main method, you can also create additional methods with whatever names you want to use. (String[] args): Oh boy. This Java element is too advanced to thoroughly explain just yet. It’s called a parameter list, and it’s used to pass data to a method. Java requires that the main method must receive a single parameter that’s an array of String objects. By convention, this parameter is named args. If you don’t know what a parameter, a String, or an array is, don’t worry about it now :).
  • Another {: Another set of braces. These mark the body of the main method. In short, whenever you come to a closing brace, it is paired with the most recent opening brace that hasn’t already been closed — that is, that hasn’t already been paired with a closing brace.
  • System.out.println("Hello, World!”);: This is the only statement in the entire program. It calls a method named println that belongs to the System.out object. The println method displays a line of text on the console. The text to be displayed is passed to the println method as a parameter in parentheses following the  word println. In this case, the text is the string literal Hello, world! enclosed in a set of quotation marks. As a result, this statement displays the text Hello, World! on the console. Note that in Java, statements end with a semicolon. Because this is the only statement in the program, this line is the only one that requires a semicolon.
  • }: The closing brace that marks the end of the main method body.
  • Another }:The closing brace that marks the end of the HelloApp class body. Because this program consists of just one class, this line also marks the end of the program.

Category: JAVA Online Course | Views: 1154 | Added by: Ansari | Rating: 0.0/0
Total comments: 3
3 faheem tariq   [Entry]
wat in practical life it have oppertunties in job etc. i want to ask it is cocern with laboratory or jxt its softwareing machines

2 Ansari   [Entry]
You can download all discussed projects from forum.


1 Ansari   [Entry]
In case of any problems. I will be online after 9 PM for discussion Or you can leave a comment.

Name *:
Email *:
Code *:
Log In

«  September 2011  »
Entries archive
Site friends
Copyright MyCorp © 2020
Free website builderuCoz