Java/C2/Programming-features-Eclipse/English

From Script | Spoken-Tutorial
Revision as of 15:40, 27 November 2012 by Chandrika (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Author: TalentSprintScript Title: Programming Features of EclipseKeywords: Features of Eclipse, Eclipse IDE, auto completion, error dialog box, syntax highlighting, shortcut keys.


Visual cue
Narration
Slide 1Welcome Welcome to the spoken tutorial on Programming Features of Eclipse.



Slide 2Learning Objectives


In this tutorial, we will learn how to use

the user- friendly programming features of Eclipse effectively.



Slide 3Tools Used For this tutorial we are usingUbuntu 11.0, JDK 1.6, and Eclipse 3.7.0
Slide 4Pre-requisites To follow this tutorial,

Eclipse must be installed in your system, and

You must have a basic knowledge of writing a simple java program in Eclipse.


If not, for relevant tutorial please visit our website which is as shown.

Slide 5Programming Features Used in Eclipse IDE Eclipse IDE supports many user friendly features such as

Auto completion,

Syntax highlighting,

Error dialog box, and

Shortcut keys.

We will look into each of these features in detail.



Switch to Eclipse IDE Interface(Auto completion)public class Features{ public static void main(string args[]) { {}} I have already created a class named Features and added the main method.


Now, we will first look at the use of the Auto completion feature in Eclipse.



Highlight main method


Type {

Hit Enter


*we could see that the highlighted part automatically gets invoked.

Now, type an opening brace inside main method and press Enter.


We can see that it automatically sets the corresponding closing brace and also positions the cursor with indentation.

Type ( inside the braces It also completes every feature that works in pairs.

For example parentheses.


We can see that we only have to type the open parenthesis and eclipse automatically adds the closing parenthesis.

Type ) Also note that if we are accustomed to type the closing parenthesis also, then it takes care of it by not adding the extra closing parenthesis.


I’m now typing the closing parenthesis and we can see that only the cursor moves to the right and the extra parenthesis is not added.

Type inside the parentheses It works in similar fashion with double quotes also.


Type a quote inside the parentheses and we see that it adds the closing quote. If we are accustomed to typing the closing quote, it takes care of it by not adding the extra quote.

Auto-completion is a very versatile feature and helps a lot in maintaining the structure of the code and also prevents typing errors like missing closing braces, missing closing parentheses and missing closing quotes.
Remove everything in the main function and type

System.out.println();


public class Features{ public static void main(string args[]) { System.out.print("hello");} }  

Remove all that we just typed.


The next programming feature we will look at is suggestion.We will type the output statement to print a word “hello”.So type the keyword System and then a dot.



Point to the drop down list.** We can see the drop down list in the eclipse after the System. The Eclipse displays a drop-down list.


The list contain some suggestions like err, in,out,console for completing the program.



Select out and hit Enter.


Type dot

Select out and press Enter.Again, type dot.
Point to the drop down list. Now Eclipse will provide suggestions like append,close,print, println() and so on.
Select println() and press Enter. Select println() and press Enter.
Eclipse IDE


Let us move on to the Syntax highlighting feature of Eclipse.While writing the program, certain keywords will get highlighted automatically.
Highlight class name


Highlight method

You can see the class name keyword highlighted in pink colour.

The method name keyword is highlighted in blue colour. This Syntax highlighting feature helps us to differentiate between various keywords.

Eclipse IDEpublic class HelloWorld {public static void main(String args[]) { X System.out.println("Hello World")}}Remove the ;


Eclipse also helps the programmer to find out the errors.In a program, an Error is denoted by a red cross symbol. Now, in this program let us remove the semicolon from the output statement.
Point to the red cross. A red cross symbol appears in the beginning of the output statement.
Hover the mouse over the red cross symbol. When we hover the mouse over the Cross symbol, we see the error details.
Point to the errors and solution. The solution to resolve the error is also shown.
Run it.

Point to the Error Dialog Box

If we proceed to the run without fixing errors, it warns us.


The error details are displayed in the Error Dialog Box.

Click Proceed


Add semicolon at the end of print statement.

Let us proceed for now.


In the problems portlet, all the errors with fixes are shown.


Let us resolve the error by adding semi-colon

Keep the Eclipse IDE Window open. The next programmer friendly feature of eclipse is the shortcut-keys.
The common shortcut-keys in any program are Ctrl+S for saving and Ctrl+O for opening.


Eclipse has shortcut keys for many such commonly used functions.

Eclipse IDE


Press Ctrl+F11


Point to the output screen

Control F11. is the shortcut for running the code. Let us try it now.

We see the output.

Click Run and point to Debug The shortcut keys for other options can be found by looking at the menu.


Notice that on the right end of the option, the shortcut is given.


So the shortcut key for Debug is F11

This is just a small but most commonly used list of the programming features of Eclipse. We shall look at more, in subsequent tutorials.
Slide 6Summary We have come to the end of this tutorial. In this tutorial, we learnt how to use programming features of Eclipse such as

Auto completion,

Syntax highlighting,

Error dialog box, and

Shortcut keys, effectively.

Slide 7

Assignment

Now, do an Assignment on what we learnt. Write a simple Java program with a class that prints “Hello” as the output on your screen.

Apply all the programming features of Eclipse.

Also observe the corresponding changes which we discussed.

Slide 8

Show About SlideAbout the Spoken Tutorial Project

  • It summarises the Spoken Tutorial project
  • If you do not have good bandwidth, you can download and watch it.


To know more about the Spoken Tutorial project, watch the video available at the following link that summarizes the project.Alternatively, you can download and watch it.
Slide 9

Show About SlideSpoken Tutorial WorkshopsThe Spoken Tutorial Project Team

  • Conducts workshops using spoken tutorials
  • Gives certificates for those who pass an online test
  • For more details, please write to contact@spoken-tutorial.org


The Spoken Tutorial Project Team:Conducts workshops using spoken tutorials.Gives certificates for those who pass an online test. For more details, please write to contact AT spoken HYPHEN tutorial DOT org.
Slide 10

Acknowledgement

  • Spoken Tutorial Project is a part of the Talk to a Teacher project
  • It is supported by the National Mission on Education through ICT, MHRD, Government of India
  • More information on this Mission is available at


Spoken Tutorial Project is a part of the Talk to a Teacher project.It is supported by the National Mission on Education through ICT, MHRD, Government of India.More information on this Mission is available at spoken HYPHEN tutorial DOT org SLASH NMEICT HYPHEN Intro
Slide 11About the contributor
  • This tutorial has been contributed by TalentSprint
  • www.talentsprint.com

Thanks for joining

This tutorial has been contributed by TalentSprint. Thanks for joining.

Contributors and Content Editors

Chandrika, Sneha