Trainings 11/4 Intro to Java.

Slides:



Advertisements
Similar presentations
AP Computer Science Anthony Keen. Computer 101 What happens when you turn a computer on? –BIOS tries to start a system loader –A system loader tries to.
Advertisements

STRING AN EXAMPLE OF REFERENCE DATA TYPE. 2 Primitive Data Types  The eight Java primitive data types are:  byte  short  int  long  float  double.
Chapter 2: Using Objects Part 1. To learn about variables To understand the concepts of classes and objects To be able to call methods To learn about.
CS0007: Introduction to Computer Programming Console Output, Variables, Literals, and Introduction to Type.
CS324e - Elements of Graphics and Visualization A Little Java A Little Python.
1 Java Basics. 2 Compiling A “compiler” is a program that translates from one language to another Typically from easy-to-read to fast-to-run e.g. from.
CIS 234: Using Data in Java Thanks to Dr. Ralph D. Westfall.
Introduction to Computers and Programming Lecture 4: Mathematical Operators New York University.
Some basic I/O.
Objects & Object-Oriented Programming (OOP) CSC 1401: Introduction to Programming with Java Week 15 – Lecture 1 Wanda M. Kunkle.
Computer Science A 2: 6/2. Course plan Introduction to programming Basic concepts of typical programming languages. Tools: compiler, editor, integrated.
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL Adrian Ilie COMP 14 Introduction to Programming Adrian Ilie June 27, 2005.
Hello, world! Dissect HelloWorld.java Compile it Run it.
Principles of Computer Programming (using Java) Review Haidong Xue Summer 2011, at GSU.
© The McGraw-Hill Companies, 2006 Chapter 1 The first step.
Introduction to Java Appendix A. Appendix A: Introduction to Java2 Chapter Objectives To understand the essentials of object-oriented programming in Java.
CSM-Java Programming-I Spring,2005 Introduction to Objects and Classes Lesson - 1.
Introduction to Python
General Features of Java Programming Language Variables and Data Types Operators Expressions Control Flow Statements.
Chapter 1 Introduction to Java 10/8/2015 Lecture 1 1.
CH2 – Using Data. Constant Something which cannot be changed Data Type Format and size of a data item Intrinsic Data Types Pg. 47 – Table 2-1 Basic ones.
Java means Coffee Java Coffee Beans The name “JAVA” was taken from a cup of coffee.
David Streader Computer Science Victoria University of Wellington Copyright: David Streader, Victoria University of Wellington Java Programing Basics COMP.
David Streader Computer Science Victoria University of Wellington Copyright: David Streader, Victoria University of Wellington Java Programing Basics COMP.
 JAVA Compilation and Interpretation  JAVA Platform Independence  Building First JAVA Program  Escapes Sequences  Display text with printf  Data.
Chapter 1 Object Orientation: Objects and Classes.
CIT 590 Intro to Programming First lecture on Java.
Java Programming: From Problem Analysis to Program Design, 4e Chapter 2 Basic Elements of Java.
COP INTERMEDIATE JAVA Review of COP2250 Concepts.
Object-Oriented Program Development Using Java: A Class-Centered Approach, Enhanced Edition.
CHAPTER 4 GC 101 Data types. DATA TYPES  For all data, assign a name (identifier) and a data type  Data type tells compiler:  How much memory to allocate.
Applications Development
BEGINNING PROGRAMMING.  Literally – giving instructions to a computer so that it does what you want  Practically – using a programming language (such.
C# C1 CSC 298 Elements of C# code (part 1). C# C2 Style for identifiers  Identifier: class, method, property (defined shortly) or variable names  class,
Copyright Curt Hill Variables What are they? Why do we need them?
Getting Started Java Fundamentals CSC207 – Software Design Summer 2011 – University of Toronto – Department of Computer Science.
Presented by Lee Zenke 2015 Java Programming PT. 1.
By Mr. Muhammad Pervez Akhtar
Aside: Running Supplied *.java Programs Just double clicking on a *.java file may not be too useful! 1.In Eclipse, create a project for this program or.
Spring 2009 Programming Fundamentals I Java Programming XuanTung Hoang Lecture No. 8.
David Streader Computer Science Victoria University of Wellington Copyright: David Streader, Victoria University of Wellington Java Programing Basics COMP.
Computer Programming II Lecture 4. Functions - In C++ we use modules to divide the program into smaller and manageable code. These modules are called.
A Sample Program #include using namespace std; int main(void) { cout
Features of JAVA PLATFORM INDEPENDENT LANGUAGE JAVA RUNTIME ENVIRONMENT (JRE) JAVA VIRTUAL MACHINE (JVM) JAVA APP BYTE CODE JAVA RUNTIME ENVIRONMENT.
 It is a pure oops language and a high level language.  It was developed at sun microsystems by James Gosling.
Objects as a programming concept
Chapter 2 Basic Computation
JAVA MULTIPLE CHOICE QUESTION.
Intro to ETEC Java.
Chapter 4 Assignment Statement
Chapter 7: Expressions and Assignment Statements
Java Course Review.
Yanal Alahmad Java Workshop Yanal Alahmad
Object Oriented Programming
Chapter 7: Expressions and Assignment Statements
Java Review Hello..This ppt is to give you an introduction about java and why it is soo special The segments all discussed here are the crucial parts of.
Chapter 3 Assignment Statement
Programming Language Concepts (CIS 635)
Electrical Trainings MVRT
Java Programming: From Problem Analysis to Program Design, 4e
Unit-2 Objects and Classes
IFS410 Advanced Analysis and Design
Chapter 2: Java Fundamentals
Chap 1 Chap 2 Chap 3 Chap 5 Surprise Me
Differences between Java and JavaScript
Session 2: Introduction to Object Oriented Programming
Fundamental OOP Programming Structures in Java: Comments, Data Types, Variables, Assignments, Operators.
Primitive Types and Expressions
Review of Java Fundamentals
COMPUTING.
Presentation transcript:

Trainings 11/4 Intro to Java

Wut is that? Programming Language Converses with machines Java is a high-level Object Oriented Programming (OOP) Language Easily understood by humans then converted to binary for machine Object Oriented → Define different “objects” in code and their “attributes” Bird object → attribute: can fly

How do I become a programmer??? You need… An Integrated Development Environment (IDE) Eclipse is what we use for robotics The JVM (Java Virtual Machine) Download the latest JDK (Java Development Kit) from Oracle https://wpilib.screenstepslive.com/s/4485/m/13503/l/599679-installing- eclipse-c-java#!prettyPhoto

Ok… How do I make it do stuffs? Java is a language Similar to English, Spanish, and French Has it’s own “rules” known as syntax Basic Syntax Sample Program

Data? Wat types? Primitive Data Types Integers byte short int long Floating Point (Decimals) float double Logic boolean Letters char

How do I use them in code?

What can I do with variables? You can do common mathematical operations Add (+) Subtract (-) Multiply (*) Divide (/) You can also use some unique operations Modulus (%) You can compare to boolean values Equal to (==) Not equal to (!=) ! → Not

Constants Values that do not change final int MY_CONSTANT = 5; Naming convention for Constants is all caps

Practice program Hello World Make a calculator using Scanner class

Methods Input Methods do things Methods are run when they are called Creating: AccessSpecifier returntype methodName(parameters) { Do Something } Calling: methodName(parameters) Do Something Output

Method Name Naming convention: Camelback First letter lowercase, other letters that begin a word are uppercase Eg: getName() printString()

Return type Value returned by the method (the output) If no return value, the type is void Return types can be the data types or objects int double float String char

Parameters Optional: Input for the method When a method is called, can pass in values Method can utilize these values Ex printString(“Hello”);

Practice Program Make methods for the calculator program Return the sum, difference, product, quotient, and modulus from each method

Classes In real world, there are individual objects of the same kind For example, there are lots of cars, but they’re all cars The cars were built from the same general blueprint A class is a blueprint from which objects can be created Within a class, there are variables and methods defining the blueprint For a car Variables: numOfWheels, maxSpeed Methods: drive, stop, turn

Inheritance Super Class/Parent Class Sub Class Inherits Information Method: Eat Super Class/Parent Class Sub Class Inherits Information Polymorphism Difference between Subclass and Parent Class Method: Fly Var: Legs = 2 Wings = 2 Method: Swim

Constructor Special method used to create an object Constructor has the same name as the class it is in Often contains variables to initialize public Classname( parameters ) { initialize stuff }

Overloading Methods with the same name but different parameters