Difference between revisions of "Java/C2/Programming-features-Eclipse/English"

From Script | Spoken-Tutorial
Jump to: navigation, search
(Created page with ''''Author''': TalentSprint'''Script Title''': Programming Features of Eclipse'''Keywords''': Features of Eclipse, Eclipse IDE, auto completion, error dialog box, syntax highlight…')
 
 
Line 9: Line 9:
 
|-
 
|-
 
| style="border:0.035cm solid #000000;padding:0cm;"| Slide 1'''Welcome'''  
 
| style="border:0.035cm solid #000000;padding:0cm;"| Slide 1'''Welcome'''  
| style="border:0.035cm solid #000000;padding:0cm;"| Welcome to the spoken tutorial on '''Programming''' '''Features of Eclipse.'''
+
| style="border:0.035cm solid #000000;padding:0cm;"| Welcome to the   tutorial on '''Programming''' '''Features of Eclipse.'''
  
  
Line 19: Line 19:
  
  
| style="border:0.035cm solid #000000;padding:0cm;"| In this tutorial, we will learn how to use
+
| style="border:0.035cm solid #000000;padding:0cm;"| In this tutorial, we will learn about
  
the user- friendly programming features of Eclipse effectively.
+
the user- friendly programming features of Eclipse
  
  
Line 32: Line 32:
 
|-
 
|-
 
| style="border:0.035cm solid #000000;padding:0cm;"| Slide 4'''Pre-requisites'''
 
| style="border:0.035cm solid #000000;padding:0cm;"| Slide 4'''Pre-requisites'''
| style="border:0.035cm solid #000000;padding:0cm;"| To follow this tutorial,  
+
| style="border:0.035cm solid #000000;padding:0cm;"| To follow this tutorial, you must have
  
 
Eclipse must be installed in your system, and  
 
Eclipse must be installed in your system, and  
  
You must have a basic knowledge of writing a simple java program in Eclipse.
+
You must know  how to write a simple java program in Eclipse.
  
  
If not, for relevant tutorial please visit our website which is as shown.
+
If not, for relevant tutorial please visit our website   as shown.
  
 
|-
 
|-
Line 60: Line 60:
 
|-
 
|-
 
| style="border:0.035cm solid #000000;padding:0.176cm;"| Switch to Eclipse IDE Interface(Auto completion)'''public class Features'''{ '''public static void main(string args<nowiki>[])</nowiki>''' '''{''' {}'''}'''
 
| style="border:0.035cm solid #000000;padding:0.176cm;"| Switch to Eclipse IDE Interface(Auto completion)'''public class Features'''{ '''public static void main(string args<nowiki>[])</nowiki>''' '''{''' {}'''}'''
| style="border:0.035cm solid #000000;padding:0.176cm;"| I have already created a class named '''Features''' and added the main method.
+
| style="border:0.035cm solid #000000;padding:0.176cm;"| I have 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.
+
  we will first look at the Auto completion feature in Eclipse.
  
  
Line 78: Line 78:
  
 
'''<nowiki>*</nowiki>we could see that the highlighted part automatically gets invoked.'''
 
'''<nowiki>*</nowiki>we could see that the highlighted part automatically gets invoked.'''
| style="border:0.035cm solid #000000;padding:0cm;"| Now, type an opening brace inside '''main''' method and press '''Enter'''.
+
| style="border:0.035cm solid #000000;padding:0cm;"| Inside the '''main method''' type an opening brace and hit'''Enter'''.
  
  
Line 87: Line 87:
 
| style="border:0.035cm solid #000000;padding:0.176cm;"| It also completes every feature that works in pairs.
 
| style="border:0.035cm solid #000000;padding:0.176cm;"| It also completes every feature that works in pairs.
  
For example parentheses.
+
For example parentheses. type open ''' parentheses'''
  
  
Line 97: Line 97:
  
  
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.
+
I’m now typing the closing parenthesis and note that only the cursor moves to the right and the extra parenthesis is not added.
  
 
|-
 
|-
Line 104: Line 104:
  
  
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.
+
Type opening quotes and it automatically closes the quotes. If we are accustomed to type the closing quotes also, it takes care of it by not adding the extra quote. I am note typing the quotes and notice that the cursor moves to the right with  the extre quotes is not added
  
 
|-
 
|-
Line 117: Line 117:
  
 
''public class Features''{ public static void main(string args<nowiki>[]) </nowiki>'''{''' System.out.print("hello");} '''} &nbsp;'''
 
''public class Features''{ public static void main(string args<nowiki>[]) </nowiki>'''{''' System.out.print("hello");} '''} &nbsp;'''
| style="border:0.035cm solid #000000;padding:0cm;"| Remove all that we just typed.
+
| style="border:0.035cm solid #000000;padding:0cm;"|  
  
  
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'''.
+
The next programming feature we will look at is '''suggestion'''.Remove all that we just typed.. We will type the output statement to print the word “hello”. '''System '' ''' dot'''.  
  
  
Line 127: Line 127:
 
|-
 
|-
 
| style="border:0.035cm solid #000000;padding:0.176cm;"| Point to the '''drop down list.<nowiki>** </nowiki>We can see the drop down list in the eclipse after the System.'''
 
| style="border:0.035cm solid #000000;padding:0.176cm;"| Point to the '''drop down list.<nowiki>** </nowiki>We can see the drop down list in the eclipse after the System.'''
| style="border:0.035cm solid #000000;padding:0.176cm;"| The Eclipse displays a drop-down list.
+
| style="border:0.035cm solid #000000;padding:0.176cm;"|Notice that Eclipse displays a drop-down list.
  
  
The list contain some suggestions like '''err, in,out,console '''for completing the program.
+
The list contain   suggestions like '''err, in,out,console ''' all sought of possible  completion
  
  
Line 140: Line 140:
  
 
Type '''dot'''
 
Type '''dot'''
| style="border:0.035cm solid #000000;padding:0cm;"| Select '''out''' and press '''Enter'''.Again, type '''dot.'''
+
| style="border:0.035cm solid #000000;padding:0cm;"| Scroll down to '''out''' and press '''Enter'''.Again, type a '''dot.'''
  
 
|-
 
|-
 
| style="border:0.035cm solid #000000;padding:0.176cm;"| Point to the''' drop down list.'''
 
| style="border:0.035cm solid #000000;padding:0.176cm;"| Point to the''' drop down list.'''
| style="border:0.035cm solid #000000;padding:0.176cm;"| Now Eclipse will provide suggestions like '''append,close,print, println() and so on.'''
+
| style="border:0.035cm solid #000000;padding:0.176cm;"| Now Eclipse will provide suggestions from the out module.
  
 
|-
 
|-
 
| style="border:0.035cm solid #000000;padding:0.176cm;"| Select '''println()''' and press '''Enter'''.
 
| style="border:0.035cm solid #000000;padding:0.176cm;"| Select '''println()''' and press '''Enter'''.
| style="border:0.035cm solid #000000;padding:0.176cm;"| Select '''println()''' and press '''Enter'''.
+
| style="border:0.035cm solid #000000;padding:0.176cm;"| Scroll down to  '''println()''' and press '''Enter'''.Now inside the paranthesis in quotes type'''Hello'''
  
 
|-
 
|-
Line 155: Line 155:
  
  
| style="border:0.035cm solid #000000;padding:0cm;"| Let us move on to the '''Syntax highlighting''' feature of Eclipse.While writing the program, certain keywords will get highlighted automatically.  
+
| style="border:0.035cm solid #000000;padding:0cm;"|next features we will looking at is the '''Syntax highlighting''' feature .  
 
+
 
|-
 
|-
 
| style="border:0.035cm solid #000000;padding:0.176cm;"| Highlight '''class name'''
 
| style="border:0.035cm solid #000000;padding:0.176cm;"| Highlight '''class name'''
Line 162: Line 161:
  
 
Highlight '''method'''
 
Highlight '''method'''
| style="border:0.035cm solid #000000;padding:0.176cm;"| You can see the '''class name keyword''' highlighted in pink colour.
+
| style="border:0.035cm solid #000000;padding:0.176cm;"| Note that the keyword public  class, public static void  are all in different color 
  
The '''method''' name keyword is highlighted in blue colour. This Syntax highlighting feature helps us to differentiate between various keywords.
+
Also note that the word''' Hello''' is in '''blue''' color indicating that this is the string. This Syntax highlighting feature helps us to differentiate between keywords and different parts of the code
  
 
|-
 
|-
Line 171: Line 170:
  
  
| style="border:0.035cm solid #000000;padding:0cm;"| 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.  
+
| style="border:0.035cm solid #000000;padding:0cm;"| Eclipse also helps the programmer to find out the errors.  
  
 
|-
 
|-
 
| style="border:0.035cm solid #000000;padding:0.176cm;"| Point to the '''red cross.'''
 
| style="border:0.035cm solid #000000;padding:0.176cm;"| Point to the '''red cross.'''
| style="border:0.035cm solid #000000;padding:0.176cm;"| A red cross symbol appears in the beginning of the output statement.
+
| style="border:0.035cm solid #000000;padding:0.176cm;"|In a program, an Error is denoted by a red cross symbol on the left margin.  
  
 
|-
 
|-
 
| style="border:0.035cm solid #000000;padding:0.176cm;"| '''Hover the mouse over the red cross symbol.'''
 
| style="border:0.035cm solid #000000;padding:0.176cm;"| '''Hover the mouse over the red cross symbol.'''
| style="border:0.035cm solid #000000;padding:0.176cm;"| When we hover the mouse over the Cross symbol, we see the error details.
+
| style="border:0.035cm solid #000000;padding:0.176cm;"| in this program we can see their is an error and mouse hover on the error
 
+
 
|-
 
|-
 
| style="border:0.035cm solid #000000;padding:0.176cm;"| Point to the errors and solution.
 
| style="border:0.035cm solid #000000;padding:0.176cm;"| Point to the errors and solution.
| style="border:0.035cm solid #000000;padding:0.176cm;"| The solution to resolve the error is also shown.  
+
| style="border:0.035cm solid #000000;padding:0.176cm;"| We can see that the error says; semi-colon missing and the solution to resolve the error is also shown.  
  
 
|-
 
|-
Line 189: Line 187:
  
 
Point to the''' Error Dialog Box'''
 
Point to the''' Error Dialog Box'''
| style="border:0.035cm solid #000000;padding:0.176cm;"| If we proceed to the '''run''' without fixing errors, it warns us.
+
| style="border:0.035cm solid #000000;padding:0.176cm;"| If we proceed to the '''run''' without fixing the error  right click select '''run as''' java application
  
  
The error details are displayed in the '''Error Dialog Box.'''
+
We have  '''Error Dialog Box.''' indicating that  their is an error  asking should we proceed or not
  
 
|-
 
|-
Line 199: Line 197:
  
 
Add semicolon at the end of print statement.
 
Add semicolon at the end of print statement.
| style="border:0.035cm solid #000000;padding:0.176cm;"| Let us proceed for now.
+
| style="border:0.035cm solid #000000;padding:0.176cm;"|For now let us proceed. We notice that their is output indicating that their is an error and when we go to problem console  all the problem with possible solution are listed
  
 
+
In the problems portlet, all the errors with fixes are shown.
+
So Let us resolve the error by adding a semi-colon. Ctrl S to save
 
+
 
+
Let us resolve the error by adding semi-colon
+
  
 
|-
 
|-
Line 226: Line 221:
  
 
Point to the output screen
 
Point to the output screen
| style="border:0.035cm solid #000000;padding:0cm;"| '''Control''' '''F11'''. is the shortcut for running the code. Let us try it now.
+
| style="border:0.035cm solid #000000;padding:0cm;"| '''Control''' '''F11'''. is the shortcut for running the code. Let us try it now.Hold '''Ctrl''' and press F11 and we see that the code is run and the output '''Hello''' has been printed
 
+
We see the output.
+
  
 +
 
|-
 
|-
 
| style="border:0.035cm solid #000000;padding:0.176cm;"| Click '''Run''' and point to '''Debug'''
 
| style="border:0.035cm solid #000000;padding:0.176cm;"| Click '''Run''' and point to '''Debug'''
| style="border:0.035cm solid #000000;padding:0.176cm;"| The shortcut keys for other options can be found by looking at the menu.
+
| style="border:0.035cm solid #000000;padding:0.176cm;"| The shortcut keys for other options can be found by looking at the menu. Click ''' Run'''
  
  
Notice that on the right end of the option, the shortcut is given.
+
Notice that on the right end of the option, their is  the shortcut is given.
  
  
Line 246: Line 240:
 
|-
 
|-
 
| style="border:0.035cm solid #000000;padding:0cm;"| Slide 6'''Summary'''
 
| style="border:0.035cm solid #000000;padding:0cm;"| Slide 6'''Summary'''
| style="border:0.035cm solid #000000;padding:0cm;"| We have come to the end of this tutorial. In this tutorial, we learnt how to use programming features of Eclipse such as  
+
| style="border:0.035cm solid #000000;padding:0cm;"| this brings us to the end of this tutorial. In this tutorial, we learnt how to use programming features of Eclipse such as  
  
 
Auto completion,  
 
Auto completion,  
Line 260: Line 254:
  
 
'''Assignment '''
 
'''Assignment '''
| style="border:0.035cm solid #000000;padding:0cm;"| 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.
+
| style="border:0.035cm solid #000000;padding:0cm;"| As  an Assignment for this tutorial Write a simple Java program with a class that prints “Hello”
 
+
Apply all the programming features of Eclipse.
+
  
Also observe the corresponding changes which we discussed.
+
In the process Apply all the programming features of Eclipse.
  
 +
  observe  its functions
 
|-
 
|-
 
| style="border:0.035cm solid #000000;padding:0cm;"| Slide 8
 
| style="border:0.035cm solid #000000;padding:0cm;"| Slide 8

Latest revision as of 09:31, 8 May 2013

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 tutorial on Programming Features of Eclipse.



Slide 2Learning Objectives


In this tutorial, we will learn about

the user- friendly programming features of Eclipse



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, you must have

Eclipse must be installed in your system, and

You must know how to write a simple java program in Eclipse.


If not, for relevant tutorial please visit our website 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 created a class named Features and added the main method.


 we will first look at the  Auto completion feature in Eclipse.



Highlight main method


Type {

Hit Enter


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

Inside the main method type an opening brace and hitEnter.


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. type open 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 note 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 opening quotes and it automatically closes the quotes. If we are accustomed to type the closing quotes also, it takes care of it by not adding the extra quote. I am note typing the quotes and notice that the cursor moves to the right with the extre quotes is not added

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");} }  


The next programming feature we will look at is suggestion'.Remove all that we just typed.. We will type the output statement to print the word “hello”. System dot.



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


The list contain suggestions like err, in,out,console all sought of possible completion



Select out and hit Enter.


Type dot

Scroll down to out and press Enter.Again, type a dot.
Point to the drop down list. Now Eclipse will provide suggestions from the out module.
Select println() and press Enter. Scroll down to println() and press Enter.Now inside the paranthesis in quotes typeHello
Eclipse IDE


next features we will looking at is the Syntax highlighting feature .
Highlight class name


Highlight method

Note that the keyword public class, public static void are all in different color

Also note that the word Hello is in blue color indicating that this is the string. This Syntax highlighting feature helps us to differentiate between keywords and different parts of the code

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.
Point to the red cross. In a program, an Error is denoted by a red cross symbol on the left margin.
Hover the mouse over the red cross symbol. in this program we can see their is an error and mouse hover on the error
Point to the errors and solution. We can see that the error says; semi-colon missing and 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 the error right click select run as java application


We have  Error Dialog Box. indicating that  their is an error  asking should we proceed or not
Click Proceed


Add semicolon at the end of print statement.

For now let us proceed. We notice that their is output indicating that their is an error and when we go to problem console all the problem with possible solution are listed


So Let us resolve the error by adding a semi-colon. Ctrl S to save
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.Hold Ctrl and press F11 and we see that the code is run and the output Hello has been printed


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


Notice that on the right end of the option, their is 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 this brings us 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

As an Assignment for this tutorial Write a simple Java program with a class that prints “Hello”

In the process Apply all the programming features of Eclipse.

 observe  its functions
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