SlideShare a Scribd company logo
1 of 20
Introduction to Javafor FIRST Robotics<br />Andrew MerrillSoftware Mentor, FRC Team 1540Computer Science Teacher, Catlin Gabel School<br />What is Java?<br />Java is a Programming Language<br />documented by the Java Language Specification<br />quot;
Java is object-oriented, strongly typed, with C-like syntaxquot;
<br />Java is a Class Library<br />documented by the:<br />Java ME CLDC API Specification, or the<br />Java SE API Specification, or the <br />Java EE API Specification<br />quot;
Java has graphics, threads, networking, data structures, etc...quot;
<br />Java is a Runtime Environment<br />documented by the Java Virtual Machine Specification<br />quot;
Java is compiled to bytecodes which are interpreted by a virtual machinequot;
<br />Goldilocks and the Three Javas<br />Small - Java Micro Edition (ME)<br />designed for mobile and embedded devices<br />used for FRC robotics<br />Medium - Java Standard Edition (SE)<br />designed for regular laptop, desktop, server applications<br />the most common edition<br />widely used in computer science courses (including AP)<br />Large - Java Enterprise Edition (EE)<br />designed for application servers, distributed systems<br />Common Java Misconceptions<br />Java is not limited to Web Programming or Applets<br />Java is not JavaScript, despite the misleadingly similar name!<br />Sample Java Programpublic class DemoBot extends IterativeRobot {  Joystick stick;  Jaguar launcher;    public void teleopInit()  {    stick = new Joystick(1);   // joystick on USB port 1    launcher = new Jaguar(2);  // speed controller on PWM port 2  }    public void teleopPeriodic()  {    if (stick.getTrigger())    // when the joystick trigger is pressed      launcher.set(0.75);      // run launcher at 75% power    else      launcher.set(0.0);       // otherwise, stop the launcher  }}Classes<br />A class defines a new type of object<br />example classes: DemoBot, Joystick, Jaguar<br />Each class contains two kinds of members:<br />Fields: variables that hold data needed by this object<br />example fields: stick, launcher<br />fields are nouns<br />Methods: functions that perform the object's actions<br />example methods: getTrigger, set<br />methods are verbs<br />By convention, class names begin with a capital letter<br />Objects<br />An object is an instance of a class<br />Objects are accessed via variables<br />Variables are declared in advance to refer to objects from a particular class<br />Example:   Jaguar launcher;<br />Objects are created with the operator new<br />Example:     launcher = new Jaguar(2);<br />Members of an object are accessed with the syntax variable.member<br />Example:     launcher.set(0.75);<br />When no variable refers to an object anymore, it is automatically quot;
garbage collectedquot;
<br />By convention, variable and function names begin with a lower case letter<br />Inheritance<br />A child class can extend a parent class<br />alternative terminology: a sub-class can extend a super-class<br />Objects of the child class can do everything that objects of the parent class can do<br />child class objects inherit the fields and methods of the parent class<br />allows code to be shared between similar classes<br />Examples:<br />class DemoBot extends IterativeRobot<br />class Jaguar extends PWM<br />class Victor extends PWM<br />class Servo extends PWM<br />Child classes can override parent class methods<br />new method must have the same name and parameters<br />Example: teleopPeriodic() in IterativeRobot <br />Differences from C++<br />no multiple inheritance<br />all methods can be overridden by default<br />all classes extend the built-in Object class<br />Constructors<br />A constructor is a special method in class<br />It is automatically run when a new object is created<br />Constructors always have exactly the same name as the class<br />Constructors have no return type<br />Constructors are often used to initialize the class's fields<br />Example:<br />public class DemoBot extends SimpleRobot {  Joystick stick;  Jaguar launcher;  DemoBot()  {    stick = new Joystick(1);    launcher = new Jaguar(2);  }<br />Interfaces<br />An interface is like a class, but...<br />it has no fields<br />its methods have no bodies<br />So what does it have?<br />method names with their parameters and return type<br />A class can implement an interface (or several interfaces)<br />Think of an interface as a promise to write certain methods<br />Example interface:      interface SpeedController     {          double get();          void set(double speed);     }<br />To implement an interface:<br />class Jaguar extends PWM implements SpeedController<br />Static and Final<br />A static field is a class field, not an object field<br />A final field is a constant - its value can't be changed<br />Example:  static final int maxAngle = 90;<br />Example: Joystick.BUTTON_TRIGGER<br />A static method can be run without making an object first<br />Example:  time = Timer.getUsClock();<br />Packages and Importing<br />Java classes can be organized into packages<br />Each package goes in a separate directory (or folder)<br />How to use a class from the package edu.wpi.first.wpilibj:<br />Write the package name every time you use the class name<br />Example:   stick = new edu.wpi.first.wpilibj.Joystick(1);<br />or import the class from the package<br />Example:   import edu.wpi.first.wpilibj.Joystick;<br />or import every class from the package<br />Example:   import edu.wpi.first.wpilibj.*;<br />The Java library package java.lang is always imported automatically<br />Class Member Access Control<br />Java restricts who can access the members of a class<br />Can be accessed from the same classCan be accessed from the same packageCan be accessed from any child classCan be accessed from any classprivateyesnonono(default)yesyesnonoprotectedyesyesyesnopublicyesyesyesyes<br />Java Data Types<br />Number Types<br />Integers<br />byte (8 bits, range from -128 to 127)<br />short (16 bits, range of _ 32767)<br />int (32 bits, range of about _ 2 billion)<br />long (64 bits, range of about _ 9 quintillion or 1019)<br />Floating Point<br />float (32 bits, range of about _ 1038, precision of about 7 decimal digits)<br />double (64 bits, range of about _ 10308, precision of about 16 decimal digits)<br />Other Types<br />boolean (true or false)<br />char (one Unicode character)<br />String (standard library class)<br />wrapper classes: Byte, Short, Integer, Long, Float, Double, Boolean, Character<br />Note: No unsigned numbers, unlike C/C++ Math<br />+ for addition<br />- for subtraction<br />* for multiplication<br />/ for division (warning: if you divide two integer types, you'll get an integer type result)<br />% for remainder after division (for example, 10 % 3 is 2)<br />Math.sqrt(x) for square root<br />Math.abs(x) for absolute value<br />Math.min(a,b), Math.max(a,b) for minimum and maximum<br />Math.sin(x), Math.cos(x), Math.tan(x) for trigonometry<br />If you need more math functions: import com.sun.squawk.util.MathUtils<br />MathUtils.pow(a,b), MathUtils.log(a), MathUtils.atan2(y,x)<br />Randomness<br />The Java library provides a class called Random<br />It is in the java.util package, so you should import java.util.Random;<br />A Random object is a random number generator<br />Only create one random number generator per program!<br />Example: public static Random generator = new Random();<br />Example: How to generate a random integer in the range 0...359:<br />int spinDirection = generator.nextInt(360);<br />Example: How to generate a random floating point number in the range 0...1:<br />double probability = generator.nextDouble();<br />Casting<br />To force a double into an int (losing the decimal part):<br />int x = (int) 3.7;<br />To force an int to be treated as a double:<br />double average = ((double) total) / count;<br />To tell Java that an Object is really a Jaguar:<br />Jaguar launcher = (Jaguar) getSpeedController();<br />Exceptions<br />When your program crashes, Java throws an Exception<br />Example:<br />java.lang.ArithmeticException: / by zero   at DemoBot.teleopPeriodic(DemoBot.java:15)<br />You can catch and handle Exceptions yourself:<br />try {     // do possibly dangerous stuff here     // keep doing stuff} catch (Exception e) {    launcher.set(0);    System.out.println(quot;
launcher disabledquot;
);    System.out.println(quot;
caught: quot;
 + e.getMessage());}<br />Java ME Data Structures<br />Arrays<br />Fixed number of elements<br />All elements of the same type (or compatible types)<br />Random access by element index number<br />Useful array utilities in the package com.sun.squawk.util.Arrays<br />sort, copy, fill, binarySearch<br />Example:<br />int data[] = new int[100];data[0] = 17;data[5] = data[0] + 1;System.out.println(data[17]);<br />Vector<br />Variable number of elements<br />All elements must be objects<br />Random access by element index number<br />import java.util.Vector;<br />Example:<br />Vector speedControllers = new Vector();speedControllers.addElement(new Jaguar(1));Jaguar controller = (Jaguar) speedControllers.elementAt(0);<br />Hashtable<br />Otherwise known as a dictionary, map, associative array, lookup table<br />Given a key, can quickly find the associated value<br />Both the key and value must be objects<br />import java.util.Hashtable;<br />Example:<br />Hashtable animals = new Hashtable();animals.put(quot;
cowquot;
, quot;
mooquot;
);animals.put(quot;
chickenquot;
, quot;
cluckquot;
);animals.put(quot;
pigquot;
, quot;
oinkquot;
);String chickenSound = (String) animals.get(quot;
chickenquot;
);System.out.println(quot;
a chicken goesquot;
 + chickenSound);<br />Other Data Structures:<br />SortedVector in edu.wpi.first.wpilibj.util<br />Stack in java.util<br />IntHashtable in com.sun.squawk.util<br />Resources<br />Websites<br />WPI's Java for FRC page:<br />http://first.wpi.edu/FRC/frcjava.html<br />Read Getting Started With Java For FRC and WPI Library Users Guide<br />Download the JavaDoc class library reference for WPILibJ<br />FRC 2011 Java Beta Test Forum:<br />http://forums.usfirst.org/forumdisplay.php?f=1462<br />Java Forum on Chief Delphi<br />http://www.chiefdelphi.com/forums/forumdisplay.php?f=184<br />Official Sun/Oracle Java Tutorial<br />http://download.oracle.com/javase/tutorial/<br />Books<br />Java in a Nutshell by David Flanagan (O'Reilly)<br />Effective Java by Joshua Bloch<br />Using Java for FRC RoboticsInstalling Java for FRC<br />You do not need LabView or WindRiver Workbench (C++) installed<br />In fact, you don't need anything from the FIRST DVD<br />Works on Windows (including Windows 7), Mac OS X, and Linux<br />Download the Java SE JDK and the NetBeans IDE<br />The Java SE JDK is available from http://java.sun.com<br />NetBeans is available from http://netbeans.org/downloads (get the Java SE version)<br />OR, you can download the Java JDK/NetBeans Bundle from Sun/Oracle<br />Install the JDK and NetBeans<br />Follow the instructions in Getting Started With Java for FRC to download and install FRC plugins:<br />Select Tools -> Plugins -> Settings, and click Add<br />Type the Name quot;
FRC Javaquot;
<br />Type the URL quot;
http://first.wpi.edu/FRC/java/netbeans/update/updates.xmlquot;
<br />On the Available Plugins tab, select the 5 FRC Java plugins, and click Install<br />Accept all of the agreements, and ignore the validation warning<br />Restart NetBeans<br />Select Tools -> Options (or NetBeans -> Preferences on a Mac)<br />Select Miscellaneous -> FRC Configuration and enter your team number<br />You're done!<br />After installing the plugins, you should have a sunspotfrcsdk folder in your home directory<br />sunspotfrcsdk/doc/javadoc/index.html has the class library documentation<br />sunspotfrcsdk/lib/WPILibJ/src has the class library source code<br />Creating and Running a Java Program<br />From the File menu, select New Project<br />Select the quot;
FRC Javaquot;
 category<br />Select a template:<br />IterativeRobotTemplateProject or SimpleRobotTemplateProject<br />Click Next<br />Give your project a Project Name<br />Change the Project Location if you want<br />Click Finish<br />To run your program, either:<br />Select Run Main Project from the Run menu; or<br />Click the green triangle in the toolbar; or<br />Press F6<br />Whichever means you choose, this will:<br />Compile and build your project<br />Download your program to the cRio<br />Reboot the cRio to run your program<br />Wait for it to say it is waiting for the cRio to reboot<br />Then move to the Driver Station<br />Wait for the quot;
Communicationquot;
 and quot;
Robot Codequot;
 lights to go from red to green<br />Click quot;
Enablequot;
 to start the program<br />SimpleRobot vs. IterativeRobot<br />Your robot class will extend either SimpleRobot or IterativeRobot<br />The SimpleRobot class provides two methods you should override:<br />autonomous(), which is called when autonomous mode starts<br />operatorControl(), which is called when teleoperated mode starts<br />You need to write your own loops in these functions to keep them running<br />You can execute a sequence of actions easily<br />make sure to run getWatchdog().feed() inside your loop<br />The IterativeRobot classes provides more methods to overide:<br />disabledInit(), autonomousInit(), teleopInit()<br />called when the robot enters the given mode<br />disabledPeriodic(), autonomousPeriodic(), teleopPeriodic()<br />called approx. every 10 ms<br />disabledContinuous(), autonomousContinuous(), teleopContinuous()<br />called as fast as the robot can<br />The IterativeRobot provides the main loop for you, and calls the appropriate functions<br />You need to design your own state machine to execute a sequence of actions<br />Displaying Diagnostic Output<br />Option 1: System.out.println()<br />This is the usual way to display text output from a Java program<br />Example: System.out.println(quot;
current speed is quot;
 + speed);<br />To view the output, install the NetConsole viewer<br />NetConsole requires the National Instruments LabView libraries (installed from the FIRST DVD)<br />Download NetConsole from   http://first.wpi.edu/Images/CMS/First/NetConsoleClient_1.0.0.4.zip<br />More info is at http://first.wpi.edu/FRC/frccupdates.html (Team Update 4.0)<br />Option 2: Driver Station User Messages<br />There is a six line area for User Messages on the Driver Station<br />You can display text in it using the DriverStationLCD class<br />Example (displays quot;
Shoot the Ball!quot;
 on line 2, column 1):<br />   DriverStationLCD dsLCD = DriverStationLCD.getInstance();   dsLCD.println(DriverStationLCD.Line.kUser2, 1, quot;
Shoot the Ball!quot;
);   dsLCD.updateLCD();<br />Option 3: SmartDashboard<br />This is a new class for 2011, currently only in beta<br />More info in the next portion of the presentation<br />
First fare 2010 java-introduction
First fare 2010 java-introduction
First fare 2010 java-introduction
First fare 2010 java-introduction
First fare 2010 java-introduction
First fare 2010 java-introduction
First fare 2010 java-introduction
First fare 2010 java-introduction
First fare 2010 java-introduction
First fare 2010 java-introduction
First fare 2010 java-introduction
First fare 2010 java-introduction
First fare 2010 java-introduction
First fare 2010 java-introduction
First fare 2010 java-introduction
First fare 2010 java-introduction
First fare 2010 java-introduction
First fare 2010 java-introduction
First fare 2010 java-introduction

More Related Content

What's hot

Java fundamentals
Java fundamentalsJava fundamentals
Java fundamentalsHCMUTE
 
Pragmatic Real-World Scala (short version)
Pragmatic Real-World Scala (short version)Pragmatic Real-World Scala (short version)
Pragmatic Real-World Scala (short version)Jonas Bonér
 
scalaliftoff2009.pdf
scalaliftoff2009.pdfscalaliftoff2009.pdf
scalaliftoff2009.pdfHiroshi Ono
 
Chapter 9 - Characters and Strings
Chapter 9 - Characters and StringsChapter 9 - Characters and Strings
Chapter 9 - Characters and StringsEduardo Bergavera
 
Best practices in Java
Best practices in JavaBest practices in Java
Best practices in JavaMudit Gupta
 
Core java by a introduction sandesh sharma
Core java by a introduction sandesh sharmaCore java by a introduction sandesh sharma
Core java by a introduction sandesh sharmaSandesh Sharma
 
How Green are Java Best Coding Practices? - GreenDays @ Rennes - 2014-07-01
How Green are Java Best Coding Practices? - GreenDays @ Rennes - 2014-07-01How Green are Java Best Coding Practices? - GreenDays @ Rennes - 2014-07-01
How Green are Java Best Coding Practices? - GreenDays @ Rennes - 2014-07-01Jérôme Rocheteau
 
Function Java Vector class
Function Java Vector classFunction Java Vector class
Function Java Vector classNontawat Wongnuk
 
Lecture20 vector
Lecture20 vectorLecture20 vector
Lecture20 vectornurkhaledah
 
String and string buffer
String and string bufferString and string buffer
String and string bufferkamal kotecha
 
Core java concepts
Core    java  conceptsCore    java  concepts
Core java conceptsChikugehlot
 

What's hot (19)

Java fundamentals
Java fundamentalsJava fundamentals
Java fundamentals
 
Wrapper class
Wrapper classWrapper class
Wrapper class
 
Pragmatic Real-World Scala (short version)
Pragmatic Real-World Scala (short version)Pragmatic Real-World Scala (short version)
Pragmatic Real-World Scala (short version)
 
scalaliftoff2009.pdf
scalaliftoff2009.pdfscalaliftoff2009.pdf
scalaliftoff2009.pdf
 
Chapter 9 - Characters and Strings
Chapter 9 - Characters and StringsChapter 9 - Characters and Strings
Chapter 9 - Characters and Strings
 
Java tut1
Java tut1Java tut1
Java tut1
 
Tutorial java
Tutorial javaTutorial java
Tutorial java
 
Best practices in Java
Best practices in JavaBest practices in Java
Best practices in Java
 
Wrapper classes
Wrapper classesWrapper classes
Wrapper classes
 
Core java by a introduction sandesh sharma
Core java by a introduction sandesh sharmaCore java by a introduction sandesh sharma
Core java by a introduction sandesh sharma
 
How Green are Java Best Coding Practices? - GreenDays @ Rennes - 2014-07-01
How Green are Java Best Coding Practices? - GreenDays @ Rennes - 2014-07-01How Green are Java Best Coding Practices? - GreenDays @ Rennes - 2014-07-01
How Green are Java Best Coding Practices? - GreenDays @ Rennes - 2014-07-01
 
Java Wrapper Classes and I/O Mechanisms
Java Wrapper Classes and I/O MechanismsJava Wrapper Classes and I/O Mechanisms
Java Wrapper Classes and I/O Mechanisms
 
Function Java Vector class
Function Java Vector classFunction Java Vector class
Function Java Vector class
 
Java 5 Features
Java 5 FeaturesJava 5 Features
Java 5 Features
 
Lecture20 vector
Lecture20 vectorLecture20 vector
Lecture20 vector
 
String and string buffer
String and string bufferString and string buffer
String and string buffer
 
Core java concepts
Core    java  conceptsCore    java  concepts
Core java concepts
 
Autoboxing And Unboxing In Java
Autoboxing And Unboxing In JavaAutoboxing And Unboxing In Java
Autoboxing And Unboxing In Java
 
Java Generics
Java GenericsJava Generics
Java Generics
 

Viewers also liked

독일 녹색당 30년 ppt 1
독일 녹색당 30년 ppt 1독일 녹색당 30년 ppt 1
독일 녹색당 30년 ppt 1Heejung Lee
 
수원 강의자료
수원 강의자료수원 강의자료
수원 강의자료Heejung Lee
 
First fare 2011 effectively using the camera
First fare 2011 effectively using the cameraFirst fare 2011 effectively using the camera
First fare 2011 effectively using the cameraOregon FIRST Robotics
 
1밀리시버트의 진실 - 탈핵의 깃발 누가 들 것인가?
1밀리시버트의 진실 -  탈핵의 깃발 누가 들 것인가?1밀리시버트의 진실 -  탈핵의 깃발 누가 들 것인가?
1밀리시버트의 진실 - 탈핵의 깃발 누가 들 것인가?Heejung Lee
 
(디히터 독일탈핵과정)
(디히터 독일탈핵과정)(디히터 독일탈핵과정)
(디히터 독일탈핵과정)Heejung Lee
 
1밀리시버트(mSv)의 진실
1밀리시버트(mSv)의 진실1밀리시버트(mSv)의 진실
1밀리시버트(mSv)의 진실Heejung Lee
 
호주녹색당자료 Apgn 참석-보고
호주녹색당자료 Apgn 참석-보고호주녹색당자료 Apgn 참석-보고
호주녹색당자료 Apgn 참석-보고Heejung Lee
 
독일 녹색당 30년 ppt 1
독일 녹색당 30년 ppt 1독일 녹색당 30년 ppt 1
독일 녹색당 30년 ppt 1Heejung Lee
 
First fare 2010 lab-view creating custom dashboards
First fare 2010 lab-view creating custom dashboardsFirst fare 2010 lab-view creating custom dashboards
First fare 2010 lab-view creating custom dashboardsOregon FIRST Robotics
 

Viewers also liked (13)

독일 녹색당 30년 ppt 1
독일 녹색당 30년 ppt 1독일 녹색당 30년 ppt 1
독일 녹색당 30년 ppt 1
 
수원 강의자료
수원 강의자료수원 강의자료
수원 강의자료
 
First fare 2011 effectively using the camera
First fare 2011 effectively using the cameraFirst fare 2011 effectively using the camera
First fare 2011 effectively using the camera
 
Boletin web
Boletin webBoletin web
Boletin web
 
1밀리시버트의 진실 - 탈핵의 깃발 누가 들 것인가?
1밀리시버트의 진실 -  탈핵의 깃발 누가 들 것인가?1밀리시버트의 진실 -  탈핵의 깃발 누가 들 것인가?
1밀리시버트의 진실 - 탈핵의 깃발 누가 들 것인가?
 
(디히터 독일탈핵과정)
(디히터 독일탈핵과정)(디히터 독일탈핵과정)
(디히터 독일탈핵과정)
 
1밀리시버트(mSv)의 진실
1밀리시버트(mSv)의 진실1밀리시버트(mSv)의 진실
1밀리시버트(mSv)의 진실
 
First fare 2013 pneumatics 2013
First fare 2013   pneumatics 2013First fare 2013   pneumatics 2013
First fare 2013 pneumatics 2013
 
호주녹색당자료 Apgn 참석-보고
호주녹색당자료 Apgn 참석-보고호주녹색당자료 Apgn 참석-보고
호주녹색당자료 Apgn 참석-보고
 
독일 녹색당 30년 ppt 1
독일 녹색당 30년 ppt 1독일 녹색당 30년 ppt 1
독일 녹색당 30년 ppt 1
 
First fare 2010 field connectivity
First fare 2010 field connectivityFirst fare 2010 field connectivity
First fare 2010 field connectivity
 
First fare 2010 lab-view creating custom dashboards
First fare 2010 lab-view creating custom dashboardsFirst fare 2010 lab-view creating custom dashboards
First fare 2010 lab-view creating custom dashboards
 
First fare 2013 basic-labview
First fare 2013   basic-labviewFirst fare 2013   basic-labview
First fare 2013 basic-labview
 

Similar to First fare 2010 java-introduction

Scala Talk at FOSDEM 2009
Scala Talk at FOSDEM 2009Scala Talk at FOSDEM 2009
Scala Talk at FOSDEM 2009Martin Odersky
 
Java 5 6 Generics, Concurrency, Garbage Collection, Tuning
Java 5 6 Generics, Concurrency, Garbage Collection, TuningJava 5 6 Generics, Concurrency, Garbage Collection, Tuning
Java 5 6 Generics, Concurrency, Garbage Collection, TuningCarol McDonald
 
Java findamentals1
Java findamentals1Java findamentals1
Java findamentals1Todor Kolev
 
Java findamentals1
Java findamentals1Java findamentals1
Java findamentals1Todor Kolev
 
Java findamentals1
Java findamentals1Java findamentals1
Java findamentals1Todor Kolev
 
Qcon2011 functions rockpresentation_scala
Qcon2011 functions rockpresentation_scalaQcon2011 functions rockpresentation_scala
Qcon2011 functions rockpresentation_scalaMichael Stal
 
Introduction of Object Oriented Programming Language using Java. .pptx
Introduction of Object Oriented Programming Language using Java. .pptxIntroduction of Object Oriented Programming Language using Java. .pptx
Introduction of Object Oriented Programming Language using Java. .pptxPoonam60376
 
oops concept in java | object oriented programming in java
oops concept in java | object oriented programming in javaoops concept in java | object oriented programming in java
oops concept in java | object oriented programming in javaCPD INDIA
 
Java programming basics
Java programming basicsJava programming basics
Java programming basicsHamid Ghorbani
 
Java-Intro.pptx
Java-Intro.pptxJava-Intro.pptx
Java-Intro.pptxVijalJain3
 
Learning Java 1 – Introduction
Learning Java 1 – IntroductionLearning Java 1 – Introduction
Learning Java 1 – Introductioncaswenson
 
Unit 1 of java part 2 basic introduction
Unit 1 of java part 2 basic introduction Unit 1 of java part 2 basic introduction
Unit 1 of java part 2 basic introduction AKR Education
 
Java programing language unit 1 introduction
Java programing language unit 1 introductionJava programing language unit 1 introduction
Java programing language unit 1 introductionchnrketan
 
4CS4-25-Java-Lab-Manual.pdf
4CS4-25-Java-Lab-Manual.pdf4CS4-25-Java-Lab-Manual.pdf
4CS4-25-Java-Lab-Manual.pdfamitbhachne
 
Introduction to Client-Side Javascript
Introduction to Client-Side JavascriptIntroduction to Client-Side Javascript
Introduction to Client-Side JavascriptJulie Iskander
 
SystemVerilog OOP Ovm Features Summary
SystemVerilog OOP Ovm Features SummarySystemVerilog OOP Ovm Features Summary
SystemVerilog OOP Ovm Features SummaryAmal Khailtash
 
Chap-2 Classes & Methods.pptx
Chap-2 Classes & Methods.pptxChap-2 Classes & Methods.pptx
Chap-2 Classes & Methods.pptxchetanpatilcp783
 

Similar to First fare 2010 java-introduction (20)

Scala Talk at FOSDEM 2009
Scala Talk at FOSDEM 2009Scala Talk at FOSDEM 2009
Scala Talk at FOSDEM 2009
 
Java 5 6 Generics, Concurrency, Garbage Collection, Tuning
Java 5 6 Generics, Concurrency, Garbage Collection, TuningJava 5 6 Generics, Concurrency, Garbage Collection, Tuning
Java 5 6 Generics, Concurrency, Garbage Collection, Tuning
 
Java findamentals1
Java findamentals1Java findamentals1
Java findamentals1
 
Java findamentals1
Java findamentals1Java findamentals1
Java findamentals1
 
Java findamentals1
Java findamentals1Java findamentals1
Java findamentals1
 
Qcon2011 functions rockpresentation_scala
Qcon2011 functions rockpresentation_scalaQcon2011 functions rockpresentation_scala
Qcon2011 functions rockpresentation_scala
 
Introduction of Object Oriented Programming Language using Java. .pptx
Introduction of Object Oriented Programming Language using Java. .pptxIntroduction of Object Oriented Programming Language using Java. .pptx
Introduction of Object Oriented Programming Language using Java. .pptx
 
oops concept in java | object oriented programming in java
oops concept in java | object oriented programming in javaoops concept in java | object oriented programming in java
oops concept in java | object oriented programming in java
 
Java Tutorial
Java TutorialJava Tutorial
Java Tutorial
 
Java programming basics
Java programming basicsJava programming basics
Java programming basics
 
Java-Intro.pptx
Java-Intro.pptxJava-Intro.pptx
Java-Intro.pptx
 
Java Generics
Java GenericsJava Generics
Java Generics
 
Learning Java 1 – Introduction
Learning Java 1 – IntroductionLearning Java 1 – Introduction
Learning Java 1 – Introduction
 
Unit 1 of java part 2 basic introduction
Unit 1 of java part 2 basic introduction Unit 1 of java part 2 basic introduction
Unit 1 of java part 2 basic introduction
 
Java programing language unit 1 introduction
Java programing language unit 1 introductionJava programing language unit 1 introduction
Java programing language unit 1 introduction
 
Java14
Java14Java14
Java14
 
4CS4-25-Java-Lab-Manual.pdf
4CS4-25-Java-Lab-Manual.pdf4CS4-25-Java-Lab-Manual.pdf
4CS4-25-Java-Lab-Manual.pdf
 
Introduction to Client-Side Javascript
Introduction to Client-Side JavascriptIntroduction to Client-Side Javascript
Introduction to Client-Side Javascript
 
SystemVerilog OOP Ovm Features Summary
SystemVerilog OOP Ovm Features SummarySystemVerilog OOP Ovm Features Summary
SystemVerilog OOP Ovm Features Summary
 
Chap-2 Classes & Methods.pptx
Chap-2 Classes & Methods.pptxChap-2 Classes & Methods.pptx
Chap-2 Classes & Methods.pptx
 

More from Oregon FIRST Robotics

Oregon FIRST PNW Championship Poster 2014 3
Oregon FIRST PNW Championship Poster 2014 3Oregon FIRST PNW Championship Poster 2014 3
Oregon FIRST PNW Championship Poster 2014 3Oregon FIRST Robotics
 
Oregon FIRST PNW Championship Poster 2014 2
Oregon FIRST PNW Championship Poster 2014 2Oregon FIRST PNW Championship Poster 2014 2
Oregon FIRST PNW Championship Poster 2014 2Oregon FIRST Robotics
 
Oregon FIRST PNW Championship Poster 2014 1
Oregon FIRST PNW Championship Poster 2014 1Oregon FIRST PNW Championship Poster 2014 1
Oregon FIRST PNW Championship Poster 2014 1Oregon FIRST Robotics
 
Oregon FIRST PNW Championship Poster 2014 4
Oregon FIRST PNW Championship Poster 2014 4Oregon FIRST PNW Championship Poster 2014 4
Oregon FIRST PNW Championship Poster 2014 4Oregon FIRST Robotics
 
First fare 2013 business plan presentation
First fare 2013   business plan presentationFirst fare 2013   business plan presentation
First fare 2013 business plan presentationOregon FIRST Robotics
 
First fare 2013 competitive analysis presentation
First fare 2013   competitive analysis presentationFirst fare 2013   competitive analysis presentation
First fare 2013 competitive analysis presentationOregon FIRST Robotics
 
First fare 2013 website design for frc teams
First fare 2013   website design for frc teamsFirst fare 2013   website design for frc teams
First fare 2013 website design for frc teamsOregon FIRST Robotics
 
FIRSTFare 2013 overview of electronics-2014
FIRSTFare 2013   overview of electronics-2014FIRSTFare 2013   overview of electronics-2014
FIRSTFare 2013 overview of electronics-2014Oregon FIRST Robotics
 
First fare 2013 manipulators firstfare 2013
First fare 2013   manipulators firstfare 2013First fare 2013   manipulators firstfare 2013
First fare 2013 manipulators firstfare 2013Oregon FIRST Robotics
 
First fare 2013 district model overview 2014
First fare 2013   district model overview 2014First fare 2013   district model overview 2014
First fare 2013 district model overview 2014Oregon FIRST Robotics
 
First fare 2013 crowdfunding 101 (beginner) with notes
First fare 2013   crowdfunding 101 (beginner) with notesFirst fare 2013   crowdfunding 101 (beginner) with notes
First fare 2013 crowdfunding 101 (beginner) with notesOregon FIRST Robotics
 
2013 Oregon Dept. of Education Grant Overview for FIRST Teams
2013 Oregon Dept. of Education Grant Overview for FIRST Teams2013 Oregon Dept. of Education Grant Overview for FIRST Teams
2013 Oregon Dept. of Education Grant Overview for FIRST TeamsOregon FIRST Robotics
 
2013 Oregon Dept. of Education FIRST Grant Overview
2013 Oregon Dept. of Education FIRST Grant Overview 2013 Oregon Dept. of Education FIRST Grant Overview
2013 Oregon Dept. of Education FIRST Grant Overview Oregon FIRST Robotics
 
FIRST Robotics Oregon Dept Of Education Grants - 2013
FIRST Robotics Oregon Dept Of Education Grants - 2013FIRST Robotics Oregon Dept Of Education Grants - 2013
FIRST Robotics Oregon Dept Of Education Grants - 2013Oregon FIRST Robotics
 
2013 FRC Autodesk Oregon Regional -- All you need to know webinar
2013 FRC Autodesk Oregon Regional -- All you need to know webinar2013 FRC Autodesk Oregon Regional -- All you need to know webinar
2013 FRC Autodesk Oregon Regional -- All you need to know webinarOregon FIRST Robotics
 
2013 Autodesk Oregon Regional Poster.11x17
2013 Autodesk Oregon Regional Poster.11x172013 Autodesk Oregon Regional Poster.11x17
2013 Autodesk Oregon Regional Poster.11x17Oregon FIRST Robotics
 
2013 Autodesk Oregon Regional Poster - 4
2013 Autodesk Oregon Regional Poster - 42013 Autodesk Oregon Regional Poster - 4
2013 Autodesk Oregon Regional Poster - 4Oregon FIRST Robotics
 
2013 Autodesk Oregon Regional Poster - 3
2013 Autodesk Oregon Regional Poster - 32013 Autodesk Oregon Regional Poster - 3
2013 Autodesk Oregon Regional Poster - 3Oregon FIRST Robotics
 
2013 Autodesk Oregon Regional Poster - 2
2013 Autodesk Oregon Regional Poster - 22013 Autodesk Oregon Regional Poster - 2
2013 Autodesk Oregon Regional Poster - 2Oregon FIRST Robotics
 
2013 Autodesk Oregon Regional Poster - 1
2013 Autodesk Oregon Regional Poster - 12013 Autodesk Oregon Regional Poster - 1
2013 Autodesk Oregon Regional Poster - 1Oregon FIRST Robotics
 

More from Oregon FIRST Robotics (20)

Oregon FIRST PNW Championship Poster 2014 3
Oregon FIRST PNW Championship Poster 2014 3Oregon FIRST PNW Championship Poster 2014 3
Oregon FIRST PNW Championship Poster 2014 3
 
Oregon FIRST PNW Championship Poster 2014 2
Oregon FIRST PNW Championship Poster 2014 2Oregon FIRST PNW Championship Poster 2014 2
Oregon FIRST PNW Championship Poster 2014 2
 
Oregon FIRST PNW Championship Poster 2014 1
Oregon FIRST PNW Championship Poster 2014 1Oregon FIRST PNW Championship Poster 2014 1
Oregon FIRST PNW Championship Poster 2014 1
 
Oregon FIRST PNW Championship Poster 2014 4
Oregon FIRST PNW Championship Poster 2014 4Oregon FIRST PNW Championship Poster 2014 4
Oregon FIRST PNW Championship Poster 2014 4
 
First fare 2013 business plan presentation
First fare 2013   business plan presentationFirst fare 2013   business plan presentation
First fare 2013 business plan presentation
 
First fare 2013 competitive analysis presentation
First fare 2013   competitive analysis presentationFirst fare 2013   competitive analysis presentation
First fare 2013 competitive analysis presentation
 
First fare 2013 website design for frc teams
First fare 2013   website design for frc teamsFirst fare 2013   website design for frc teams
First fare 2013 website design for frc teams
 
FIRSTFare 2013 overview of electronics-2014
FIRSTFare 2013   overview of electronics-2014FIRSTFare 2013   overview of electronics-2014
FIRSTFare 2013 overview of electronics-2014
 
First fare 2013 manipulators firstfare 2013
First fare 2013   manipulators firstfare 2013First fare 2013   manipulators firstfare 2013
First fare 2013 manipulators firstfare 2013
 
First fare 2013 district model overview 2014
First fare 2013   district model overview 2014First fare 2013   district model overview 2014
First fare 2013 district model overview 2014
 
First fare 2013 crowdfunding 101 (beginner) with notes
First fare 2013   crowdfunding 101 (beginner) with notesFirst fare 2013   crowdfunding 101 (beginner) with notes
First fare 2013 crowdfunding 101 (beginner) with notes
 
2013 Oregon Dept. of Education Grant Overview for FIRST Teams
2013 Oregon Dept. of Education Grant Overview for FIRST Teams2013 Oregon Dept. of Education Grant Overview for FIRST Teams
2013 Oregon Dept. of Education Grant Overview for FIRST Teams
 
2013 Oregon Dept. of Education FIRST Grant Overview
2013 Oregon Dept. of Education FIRST Grant Overview 2013 Oregon Dept. of Education FIRST Grant Overview
2013 Oregon Dept. of Education FIRST Grant Overview
 
FIRST Robotics Oregon Dept Of Education Grants - 2013
FIRST Robotics Oregon Dept Of Education Grants - 2013FIRST Robotics Oregon Dept Of Education Grants - 2013
FIRST Robotics Oregon Dept Of Education Grants - 2013
 
2013 FRC Autodesk Oregon Regional -- All you need to know webinar
2013 FRC Autodesk Oregon Regional -- All you need to know webinar2013 FRC Autodesk Oregon Regional -- All you need to know webinar
2013 FRC Autodesk Oregon Regional -- All you need to know webinar
 
2013 Autodesk Oregon Regional Poster.11x17
2013 Autodesk Oregon Regional Poster.11x172013 Autodesk Oregon Regional Poster.11x17
2013 Autodesk Oregon Regional Poster.11x17
 
2013 Autodesk Oregon Regional Poster - 4
2013 Autodesk Oregon Regional Poster - 42013 Autodesk Oregon Regional Poster - 4
2013 Autodesk Oregon Regional Poster - 4
 
2013 Autodesk Oregon Regional Poster - 3
2013 Autodesk Oregon Regional Poster - 32013 Autodesk Oregon Regional Poster - 3
2013 Autodesk Oregon Regional Poster - 3
 
2013 Autodesk Oregon Regional Poster - 2
2013 Autodesk Oregon Regional Poster - 22013 Autodesk Oregon Regional Poster - 2
2013 Autodesk Oregon Regional Poster - 2
 
2013 Autodesk Oregon Regional Poster - 1
2013 Autodesk Oregon Regional Poster - 12013 Autodesk Oregon Regional Poster - 1
2013 Autodesk Oregon Regional Poster - 1
 

Recently uploaded

Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 

Recently uploaded (20)

Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 

First fare 2010 java-introduction

  • 1. Introduction to Javafor FIRST Robotics<br />Andrew MerrillSoftware Mentor, FRC Team 1540Computer Science Teacher, Catlin Gabel School<br />What is Java?<br />Java is a Programming Language<br />documented by the Java Language Specification<br />quot; Java is object-oriented, strongly typed, with C-like syntaxquot; <br />Java is a Class Library<br />documented by the:<br />Java ME CLDC API Specification, or the<br />Java SE API Specification, or the <br />Java EE API Specification<br />quot; Java has graphics, threads, networking, data structures, etc...quot; <br />Java is a Runtime Environment<br />documented by the Java Virtual Machine Specification<br />quot; Java is compiled to bytecodes which are interpreted by a virtual machinequot; <br />Goldilocks and the Three Javas<br />Small - Java Micro Edition (ME)<br />designed for mobile and embedded devices<br />used for FRC robotics<br />Medium - Java Standard Edition (SE)<br />designed for regular laptop, desktop, server applications<br />the most common edition<br />widely used in computer science courses (including AP)<br />Large - Java Enterprise Edition (EE)<br />designed for application servers, distributed systems<br />Common Java Misconceptions<br />Java is not limited to Web Programming or Applets<br />Java is not JavaScript, despite the misleadingly similar name!<br />Sample Java Programpublic class DemoBot extends IterativeRobot {  Joystick stick;  Jaguar launcher;    public void teleopInit()  {    stick = new Joystick(1);   // joystick on USB port 1    launcher = new Jaguar(2);  // speed controller on PWM port 2  }    public void teleopPeriodic()  {    if (stick.getTrigger())    // when the joystick trigger is pressed      launcher.set(0.75);      // run launcher at 75% power    else      launcher.set(0.0);       // otherwise, stop the launcher  }}Classes<br />A class defines a new type of object<br />example classes: DemoBot, Joystick, Jaguar<br />Each class contains two kinds of members:<br />Fields: variables that hold data needed by this object<br />example fields: stick, launcher<br />fields are nouns<br />Methods: functions that perform the object's actions<br />example methods: getTrigger, set<br />methods are verbs<br />By convention, class names begin with a capital letter<br />Objects<br />An object is an instance of a class<br />Objects are accessed via variables<br />Variables are declared in advance to refer to objects from a particular class<br />Example:   Jaguar launcher;<br />Objects are created with the operator new<br />Example:     launcher = new Jaguar(2);<br />Members of an object are accessed with the syntax variable.member<br />Example:     launcher.set(0.75);<br />When no variable refers to an object anymore, it is automatically quot; garbage collectedquot; <br />By convention, variable and function names begin with a lower case letter<br />Inheritance<br />A child class can extend a parent class<br />alternative terminology: a sub-class can extend a super-class<br />Objects of the child class can do everything that objects of the parent class can do<br />child class objects inherit the fields and methods of the parent class<br />allows code to be shared between similar classes<br />Examples:<br />class DemoBot extends IterativeRobot<br />class Jaguar extends PWM<br />class Victor extends PWM<br />class Servo extends PWM<br />Child classes can override parent class methods<br />new method must have the same name and parameters<br />Example: teleopPeriodic() in IterativeRobot <br />Differences from C++<br />no multiple inheritance<br />all methods can be overridden by default<br />all classes extend the built-in Object class<br />Constructors<br />A constructor is a special method in class<br />It is automatically run when a new object is created<br />Constructors always have exactly the same name as the class<br />Constructors have no return type<br />Constructors are often used to initialize the class's fields<br />Example:<br />public class DemoBot extends SimpleRobot {  Joystick stick;  Jaguar launcher;  DemoBot()  {    stick = new Joystick(1);    launcher = new Jaguar(2);  }<br />Interfaces<br />An interface is like a class, but...<br />it has no fields<br />its methods have no bodies<br />So what does it have?<br />method names with their parameters and return type<br />A class can implement an interface (or several interfaces)<br />Think of an interface as a promise to write certain methods<br />Example interface:      interface SpeedController     {          double get();          void set(double speed);     }<br />To implement an interface:<br />class Jaguar extends PWM implements SpeedController<br />Static and Final<br />A static field is a class field, not an object field<br />A final field is a constant - its value can't be changed<br />Example:  static final int maxAngle = 90;<br />Example: Joystick.BUTTON_TRIGGER<br />A static method can be run without making an object first<br />Example:  time = Timer.getUsClock();<br />Packages and Importing<br />Java classes can be organized into packages<br />Each package goes in a separate directory (or folder)<br />How to use a class from the package edu.wpi.first.wpilibj:<br />Write the package name every time you use the class name<br />Example:   stick = new edu.wpi.first.wpilibj.Joystick(1);<br />or import the class from the package<br />Example:   import edu.wpi.first.wpilibj.Joystick;<br />or import every class from the package<br />Example:   import edu.wpi.first.wpilibj.*;<br />The Java library package java.lang is always imported automatically<br />Class Member Access Control<br />Java restricts who can access the members of a class<br />Can be accessed from the same classCan be accessed from the same packageCan be accessed from any child classCan be accessed from any classprivateyesnonono(default)yesyesnonoprotectedyesyesyesnopublicyesyesyesyes<br />Java Data Types<br />Number Types<br />Integers<br />byte (8 bits, range from -128 to 127)<br />short (16 bits, range of _ 32767)<br />int (32 bits, range of about _ 2 billion)<br />long (64 bits, range of about _ 9 quintillion or 1019)<br />Floating Point<br />float (32 bits, range of about _ 1038, precision of about 7 decimal digits)<br />double (64 bits, range of about _ 10308, precision of about 16 decimal digits)<br />Other Types<br />boolean (true or false)<br />char (one Unicode character)<br />String (standard library class)<br />wrapper classes: Byte, Short, Integer, Long, Float, Double, Boolean, Character<br />Note: No unsigned numbers, unlike C/C++ Math<br />+ for addition<br />- for subtraction<br />* for multiplication<br />/ for division (warning: if you divide two integer types, you'll get an integer type result)<br />% for remainder after division (for example, 10 % 3 is 2)<br />Math.sqrt(x) for square root<br />Math.abs(x) for absolute value<br />Math.min(a,b), Math.max(a,b) for minimum and maximum<br />Math.sin(x), Math.cos(x), Math.tan(x) for trigonometry<br />If you need more math functions: import com.sun.squawk.util.MathUtils<br />MathUtils.pow(a,b), MathUtils.log(a), MathUtils.atan2(y,x)<br />Randomness<br />The Java library provides a class called Random<br />It is in the java.util package, so you should import java.util.Random;<br />A Random object is a random number generator<br />Only create one random number generator per program!<br />Example: public static Random generator = new Random();<br />Example: How to generate a random integer in the range 0...359:<br />int spinDirection = generator.nextInt(360);<br />Example: How to generate a random floating point number in the range 0...1:<br />double probability = generator.nextDouble();<br />Casting<br />To force a double into an int (losing the decimal part):<br />int x = (int) 3.7;<br />To force an int to be treated as a double:<br />double average = ((double) total) / count;<br />To tell Java that an Object is really a Jaguar:<br />Jaguar launcher = (Jaguar) getSpeedController();<br />Exceptions<br />When your program crashes, Java throws an Exception<br />Example:<br />java.lang.ArithmeticException: / by zero   at DemoBot.teleopPeriodic(DemoBot.java:15)<br />You can catch and handle Exceptions yourself:<br />try {     // do possibly dangerous stuff here     // keep doing stuff} catch (Exception e) {    launcher.set(0);    System.out.println(quot; launcher disabledquot; );    System.out.println(quot; caught: quot; + e.getMessage());}<br />Java ME Data Structures<br />Arrays<br />Fixed number of elements<br />All elements of the same type (or compatible types)<br />Random access by element index number<br />Useful array utilities in the package com.sun.squawk.util.Arrays<br />sort, copy, fill, binarySearch<br />Example:<br />int data[] = new int[100];data[0] = 17;data[5] = data[0] + 1;System.out.println(data[17]);<br />Vector<br />Variable number of elements<br />All elements must be objects<br />Random access by element index number<br />import java.util.Vector;<br />Example:<br />Vector speedControllers = new Vector();speedControllers.addElement(new Jaguar(1));Jaguar controller = (Jaguar) speedControllers.elementAt(0);<br />Hashtable<br />Otherwise known as a dictionary, map, associative array, lookup table<br />Given a key, can quickly find the associated value<br />Both the key and value must be objects<br />import java.util.Hashtable;<br />Example:<br />Hashtable animals = new Hashtable();animals.put(quot; cowquot; , quot; mooquot; );animals.put(quot; chickenquot; , quot; cluckquot; );animals.put(quot; pigquot; , quot; oinkquot; );String chickenSound = (String) animals.get(quot; chickenquot; );System.out.println(quot; a chicken goesquot; + chickenSound);<br />Other Data Structures:<br />SortedVector in edu.wpi.first.wpilibj.util<br />Stack in java.util<br />IntHashtable in com.sun.squawk.util<br />Resources<br />Websites<br />WPI's Java for FRC page:<br />http://first.wpi.edu/FRC/frcjava.html<br />Read Getting Started With Java For FRC and WPI Library Users Guide<br />Download the JavaDoc class library reference for WPILibJ<br />FRC 2011 Java Beta Test Forum:<br />http://forums.usfirst.org/forumdisplay.php?f=1462<br />Java Forum on Chief Delphi<br />http://www.chiefdelphi.com/forums/forumdisplay.php?f=184<br />Official Sun/Oracle Java Tutorial<br />http://download.oracle.com/javase/tutorial/<br />Books<br />Java in a Nutshell by David Flanagan (O'Reilly)<br />Effective Java by Joshua Bloch<br />Using Java for FRC RoboticsInstalling Java for FRC<br />You do not need LabView or WindRiver Workbench (C++) installed<br />In fact, you don't need anything from the FIRST DVD<br />Works on Windows (including Windows 7), Mac OS X, and Linux<br />Download the Java SE JDK and the NetBeans IDE<br />The Java SE JDK is available from http://java.sun.com<br />NetBeans is available from http://netbeans.org/downloads (get the Java SE version)<br />OR, you can download the Java JDK/NetBeans Bundle from Sun/Oracle<br />Install the JDK and NetBeans<br />Follow the instructions in Getting Started With Java for FRC to download and install FRC plugins:<br />Select Tools -> Plugins -> Settings, and click Add<br />Type the Name quot; FRC Javaquot; <br />Type the URL quot; http://first.wpi.edu/FRC/java/netbeans/update/updates.xmlquot; <br />On the Available Plugins tab, select the 5 FRC Java plugins, and click Install<br />Accept all of the agreements, and ignore the validation warning<br />Restart NetBeans<br />Select Tools -> Options (or NetBeans -> Preferences on a Mac)<br />Select Miscellaneous -> FRC Configuration and enter your team number<br />You're done!<br />After installing the plugins, you should have a sunspotfrcsdk folder in your home directory<br />sunspotfrcsdk/doc/javadoc/index.html has the class library documentation<br />sunspotfrcsdk/lib/WPILibJ/src has the class library source code<br />Creating and Running a Java Program<br />From the File menu, select New Project<br />Select the quot; FRC Javaquot; category<br />Select a template:<br />IterativeRobotTemplateProject or SimpleRobotTemplateProject<br />Click Next<br />Give your project a Project Name<br />Change the Project Location if you want<br />Click Finish<br />To run your program, either:<br />Select Run Main Project from the Run menu; or<br />Click the green triangle in the toolbar; or<br />Press F6<br />Whichever means you choose, this will:<br />Compile and build your project<br />Download your program to the cRio<br />Reboot the cRio to run your program<br />Wait for it to say it is waiting for the cRio to reboot<br />Then move to the Driver Station<br />Wait for the quot; Communicationquot; and quot; Robot Codequot; lights to go from red to green<br />Click quot; Enablequot; to start the program<br />SimpleRobot vs. IterativeRobot<br />Your robot class will extend either SimpleRobot or IterativeRobot<br />The SimpleRobot class provides two methods you should override:<br />autonomous(), which is called when autonomous mode starts<br />operatorControl(), which is called when teleoperated mode starts<br />You need to write your own loops in these functions to keep them running<br />You can execute a sequence of actions easily<br />make sure to run getWatchdog().feed() inside your loop<br />The IterativeRobot classes provides more methods to overide:<br />disabledInit(), autonomousInit(), teleopInit()<br />called when the robot enters the given mode<br />disabledPeriodic(), autonomousPeriodic(), teleopPeriodic()<br />called approx. every 10 ms<br />disabledContinuous(), autonomousContinuous(), teleopContinuous()<br />called as fast as the robot can<br />The IterativeRobot provides the main loop for you, and calls the appropriate functions<br />You need to design your own state machine to execute a sequence of actions<br />Displaying Diagnostic Output<br />Option 1: System.out.println()<br />This is the usual way to display text output from a Java program<br />Example: System.out.println(quot; current speed is quot; + speed);<br />To view the output, install the NetConsole viewer<br />NetConsole requires the National Instruments LabView libraries (installed from the FIRST DVD)<br />Download NetConsole from   http://first.wpi.edu/Images/CMS/First/NetConsoleClient_1.0.0.4.zip<br />More info is at http://first.wpi.edu/FRC/frccupdates.html (Team Update 4.0)<br />Option 2: Driver Station User Messages<br />There is a six line area for User Messages on the Driver Station<br />You can display text in it using the DriverStationLCD class<br />Example (displays quot; Shoot the Ball!quot; on line 2, column 1):<br />   DriverStationLCD dsLCD = DriverStationLCD.getInstance();   dsLCD.println(DriverStationLCD.Line.kUser2, 1, quot; Shoot the Ball!quot; );   dsLCD.updateLCD();<br />Option 3: SmartDashboard<br />This is a new class for 2011, currently only in beta<br />More info in the next portion of the presentation<br />