An Overview of the Java Programming Language

501 views

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
501
On SlideShare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
25
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide
  • This template can be used as a starter file for presenting training materials in a group setting.SectionsRight-click on a slide to add sections. Sections can help to organize your slides or facilitate collaboration between multiple authors.NotesUse the Notes section for delivery notes or to provide additional details for the audience. View these notes in Presentation View during your presentation. Keep in mind the font size (important for accessibility, visibility, videotaping, and online production)Coordinated colors Pay particular attention to the graphs, charts, and text boxes.Consider that attendees will print in black and white or grayscale. Run a test print to make sure your colors work when printed in pure black and white and grayscale.Graphics, tables, and graphsKeep it simple: If possible, use consistent, non-distracting styles and colors.Label all graphs and tables.
  • Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important.Introduce each of the major topics.To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  • This is another option for an Overview slide.
  • What will the audience be able to do after this training is complete? Briefly describe each objective how the audiencewill benefit from this presentation.
  • Use a section header for each of the topics, so there is a clear transition to the audience.
  • Add slides to each topic section as necessary, including slides with tables, graphs, and images. See next section for sampletable, graph, image, and video layouts.
  • Keep it brief. Make your text as brief as possible to maintain a larger font size.
  • Add a case study or class simulation to encourage discussion and apply lessons.
  • Discuss outcomes of the case study or class simulation.Cover best practices.
  • Summarize presentation content by restating the important points from the lessons.What do you want the audience to remember when they leave your presentation?Save your presentation to a video for easy distribution (To create a video, click the File tab, and then click Share.  Under File Types, click Create a Video.)
  • An Overview of the Java Programming Language

    1. 1. JAVA
    2. 2. Stuff about Java • Programming language • Runs on a “virtual machine” (JVM) • Platform Independent (Can run on any machine) • Object Oriented Language • Automatic Garbage Collection
    3. 3. DATA TYPES • boolean: Truth value (true or false). • int: Integer (0, 1, -47). • double: Real number (3.14, 1.0, -2.1). • String: Text (“hello world”).
    4. 4. Declaring and Assigning Variables Form: Type name; Examples: • String me = “Kenny”; • int x = 4; • double y;
    5. 5. Operators • Assignment: = • Addition: + • Subtraction: • Multiplication: * • Division: / Form: varName Op varName; Order of Operation follow standard rules
    6. 6. Methods Form: modifiers return_type name(arguments){ statements } To Call: name(arguments); Examples: public static void myMethod(int arg){ int x = 4 } public static void myMethod(int arg){ int x = 4 return x; }
    7. 7. if and “else if” Statement Form: If (condition){ } Example: if(x < 4){ System.out.println(“x is less than 4”); } else if(x > 4){ System.out.println(“x is greater than 4”); } else{ System.out.println(“x must be equal to 4”); }
    8. 8. COMPARISON OPERATORS • • • • • • x > y: x is greater than y x < y: x is less than y x >= y: x is greater than or equal to x x <= y: x is less than or equal to y x == y: x equals y ( equality: ==, assignment: = )
    9. 9. Boolean Operators • &&: logical AND return true if true • ||: logical OR returns false if false Example: if ( x > 6 && x < 9)
    10. 10. Loops Loops Information while Runs while condition is true While(x < 4){ dostuff(); } do … while Runs for the first time without checking then runs while condition is true do{ Stuff(); }while(x < 4); For Runs with optional counter while condition is true For(int I = 0; I < 4, x < 4; i++){ doStuff(); }
    11. 11. Arrays • • • • An indexed list of values Any data type All elements must have the same type Form: type[] name = { val1, val2, val3 }; OR type[ ] name = new type[noOfValues]; Int [] a = { 3, 5, 6, 8, 11, 12, 15, 17, 19, 20 } Value: Index: a[0] a[1] a[2] a[3] a[4] a[5] a[6] a[7] a[8] a[9] System.out.println(a[5]); output: 12
    12. 12. Classes To model real world problems // little baby 1 String name1;double weight1; // little baby2 String name2;double weight2; // little baby 3 String name3;double weight3; For 500 babies inefficient!!!
    13. 13. • Using Classes  Create a class Baby  Then an array of baby or babies public class Baby { String name; boolean isMale; double weight; double decibels; } Baby[] babies = new Baby[500]; • Classes can also contain methods public class Baby { … Eat() { weight += 1; } }
    14. 14. Inheritance • When a class inherits another class it has the characteristics of that class plus its own. • Classes inherit from one class • Example: A class Car can inherit from another class vehicle. • Form: modifier class className extends baseClass { }
    15. 15. Interfaces • Interfaces are like classes that cannot have object instances assigned. • They can only be implemented by classes. • Classes can implement many interfaces. • Example: interface move { void accelerate(); void speed(); }
    16. 16. QUESTIONS?

    ×