370 likes | 524 Vues
This content delves into the various features and types of cars, discussing essential components such as wheels, engines, and more. It also explores Java programming concepts through the example of a car class, illustrating how to compile and run Java programs, and the basics of creating a JAR file. Additionally, it touches on the relationship between Minecraft mods and programming, providing guidance on building plugins using the Bukkit API. This resource is perfect for beginners in programming and car enthusiasts alike.
E N D
Install Fest • SSID: XXX, Password: YYY • SSID: XXX, Password: YYY
What are the features of a car ? • Four wheels • Engine • Headlights • Windows • Seats • Doors
What are the features of a car ? • Body color • Number of doors • Number of seats • Sedan or convertible or hatchback • DVD player • GPS • Moon roof • Price
What can a car do ? • Play music • Drive • Crash • Stop
What can a car do ? • Start the engine • Shut the engine • Accelerate • Brake • Turn • Lock the doors • Play the song/movie
Types of Cars • Toy car • Race car • Mini van • Trucks • Convertible
Types of Cars • Sedan • SUV • Convertible • Hatchback • Race • Formula One
Sample Java Class class Car { String color;int door; void startEngine(); void stopEngine();}
How to make a JAR ? – Part 1 Compiles Java Program Class
What does a compiler do ? • Translates Java source code to the language understood by machine • Source code -> Byte code • Looks for errors in source code • Looks for other libraries to be included
How to compile • Java Development Kit (or JDK) • Tool: Java Compiler (javac) • What: Compile Java program • How: javacCar.java • Output: Generates Car.class
How to make a JAR ? – Part 2 010011… Class Class JAR 010011… 010011… Class
How to run • Tool: Java Virtual Machine (java) • What: Runs your Java class • How: java Car.class • Output: Performs actions from your program
Basic Java Concepts – Interface What can you do with a fruit ? • Eat it • Chuck it in the trash • Plant it • Make a chemical reaction • Make smoothie • Mash it up with a hammer
Basic Java Concepts – Interface What can you do with a fruit ? Not How • Plant it • Water it • Pick from a tree • Peel it • Eat it • Make a smoothie
Basic Java Concepts – Interface Code interface Fruit { peel(); eat(); plant();}
Basic Java Concepts – Exception What can be wrong with a fruit ? • Rotten • Rotten • Poisonous • Stinky • Fly infested • Worm infested • Spider infested
Basic Java Concepts – Exception What can be wrong with a fruit ? – Exceptional Conditions • Too ripe • Too yellow or green • Too hard or soft • Too sour or sweet • Big pit • Only part of it is good
Basic Java Concepts – Exception Code try {fruit.eat(); } catch (TooRipeException e) { fruit.dontEat();}
Minecraft Mod • What are mods ? • Changes the game content from what it originally was • Add content to the game to alter gameplay • Give more options to players • Client Mod: On the client-side, single player • Server Mod: On the server-side, multiple players
Mods you like • Pokemods • Mcedit • Industrial craft • Too many items • A grenade mod • Super mario mod • Jerry mod
Minecraft is modular • Minecraft is modular • Minecraft world is 1.5x radius of Earth • Space is loaded in chunks • Configurable “Render Distance”: Tiny, Short, Normal, Long
Bukkit • Extends Minecraft • Bukkit is the API to build plugins (aka mods for Minecraft) • CraftBukkit is a mod for the official Minecraft server that implements the API
Sample Mod Java Program Java Program JAR . . . Java Program ConfigurationFile
Build a mod http://java4kids.java.net/minecraft-workshop/ • Step 1: Download and Install Programs • Step 2: Create a Sample Plugin • Step 3: Download and Start CraftBukkit Server • Step 4: Mod the Server using Bukkit API
Resources • New to Java: http://www.oracle.com/technetwork/topics/newtojava/overview/index.html • http://java4kids.java.net