Presentation is loading. Please wait.

Presentation is loading. Please wait.

BEGINNING PROGRAMMING.  Literally – giving instructions to a computer so that it does what you want  Practically – using a programming language (such.

Similar presentations


Presentation on theme: "BEGINNING PROGRAMMING.  Literally – giving instructions to a computer so that it does what you want  Practically – using a programming language (such."— Presentation transcript:

1 BEGINNING PROGRAMMING

2  Literally – giving instructions to a computer so that it does what you want  Practically – using a programming language (such as Java) to solve a problem  Ex: Controlling a robot autonomously, mathematical computations, vision processing

3  Cross-platform write-once run anywhere high level object-oriented programming language  The Java Virtual Machine  Software that runs on most operating systems  Runs your java code  Handles all OS specific programming problems  Write a program one time and run it on every major OS

4 Java is based on Objects An Object is an instance of any class, e.g. a String variable Objects provide different functionalities depending on what it’s class was designed to do Makes programming easier because Objects do most of the work

5 public static void main(String[] args){…} Primitive types (variables) o boolean (true or false) o byte (0-255) o char (a single letter/character) o short (small integer) o int (an integer) o float (decimal number) o double (decimal with double precision of float) o long (very large integer)

6 An object is an instance of any class (e.g. an instance of the String class) String o Not a primitive type PrintStream (e.g. System.out) o Allows you to output data

7 The most basic program in any language – just prints out “Hello World” In Java

8 “Modifies” your program at runtime Changes what/when the program does something based on a test Ex: If a is greater than b, the program does one thing, and does another if a is not greater than Else – the code inside the else block executes if none of the if statements are true

9 Used when you want to do something multiple times or while a condition is true For loop While loop Do-while loop

10 Public void name(){…} Most basic definition: a block of code that does something useful Use methods to simplify code and make programming easier o Ex: arm.setAngle(90) is much easier than directly controlling the motors and stopping it at 90 degrees

11 Argument – any data that you pass to a method Ex: o Where a and b are the numbers that you want to add Arguments give data to a method so that it can do what it was designed to do

12 Public/Private – controls who can access this method o Private - only accessible within the defining class o Public - accessible by any class or object Static – no instance of object required to run the method

13 Void – doesn’t return anything o Ex: Object – returns an Object of the specified class o Ex: Return data using the return command o Ex:


Download ppt "BEGINNING PROGRAMMING.  Literally – giving instructions to a computer so that it does what you want  Practically – using a programming language (such."

Similar presentations


Ads by Google