Scala. A Java jövője. Háber János

Size: px
Start display at page:

Download "Scala. A Java jövője. Háber János"

Transcription

1 Scala A Java jövője Háber János

2 Scala > Java? - JVM-en fut - Típusos - Teljesen objektum orientált - Funkcionális programozás támogatása - Minta illesztés - Többszörös öröklődés (Mixin) - Implicit konverzió - Actor alapú konkurencia kezelés - Ruby szerű szintaxis és még sok minden

3 Scala + Java - Egyszerre használható Java és Scala ugyanabban a projektben - Használhatók a meglévő Java libek - IDE támogatás - Ha valami nem megy, csináld Jávában

4 Teljesen Objektum orientált //Minden érték egy objektum 1.toString //Minden művelet egy metódus hívás > (1).+(2).+(3) //. és ( ) elhagyható "abc" charat 1 -> "abc".charat(1)

5 Hello World //Java public class HelloWorld { public static void main(string[] args) { String message = "Hello World"; System.out.println(message); //Scala object HelloWorld { def main(args:array[string]):unit = { val message = "Hello World" println(message)

6 Singleton támogatás object Hello { def world = "Hello World" Hello.world //Hello$.class import scala.scalaobject; public final class Hello$ implements ScalaObject { private Hello$() { MODULE$ = this; public String world() { return "Hello World"; public static final MODULE$; static { new (); //Hello.class import public final class Hello { public static final String world() { return Hello..MODULE$.world();

7 Automatikus getter/setter class SimpleVal { val finalvalue: String = "hi" var simplevariable: String = "" import scala.scalaobject; import = "...removed...") public class SimpleVal implements ScalaObject { private final String finalvalue = "hi"; private String simplevariable = ""; public String finalvalue() { return this.finalvalue; public String simplevariable() { return this.simplevariable; public void simplevariable_$eq(string paramstring) { this.simplevariable = paramstring;

8 Scala - tömör //Java public class Person { private final String name; private final int age; public Person(String name,int age) { this.name = name; this.age = age; //Scala class Person(val name:string, val age:int) public String getname() { return name; public int getage() { return age;

9 Scala - tömör //Java public class Person { private String name; private int age; public Person(String name,int age) { this.name = name; this.age = age; public String getname() { return name; //Scala import reflect.beanproperty class Person var name: String = var age: Int = _ public int setname(string name) { this.name=name; public String getage() { return age; public int setage(string age) { this.age=age;

10 Típus következtetés val sum = val nums = List(1, 2, 3) val map = Map("abc" -> List(1, 2, 3)) val sum: Int = val nums: List[Int] = List(1, 2, 3) val map: Map[String, List[Int]] = Map("abc" -> List(1, 2, 3))

11 Duck typing object BigDuck { def quack(value: String) = { value.touppercase object SmallDuck { def quack(value: String) = { value.tolowercase object IamNotReallyADuck { def quack(value: String) = { "prrrrrp" def quacker(duck: {def quack(value: String): String) { println (duck.quack("quack")) quacker(bigduck) quacker(smallduck) quacker(iamnotreallyaduck) class MyDao[T <: {def id : K, K]

12 High-order funkciók def transaction(function: => Any): Any = { //... transaction { //here your database code

13 High-order funkciók def measure[t](func: => T):T = { val start = System.nanoTime() val result = func val elapsed = System.nanoTime() - start println("the execution of this call took: %s ns".format(elapsed)) result def mycallback = { Thread.sleep(1000) "I'm a callback" val result = measure(mycallback) > The execution of this call took: ns

14 High-order funkciók import org.scalatest.funsuite import scala.collection.mutable.stack class ExampleSuite extends FunSuite { test("pop is invoked on an empty stack") { val emptystack = new Stack[Int] intercept[nosuchelementexception] { emptystack.pop() assert(emptystack.isempty)

15 Scala - minta illesztés - Hasonló a Java switch-hez - Bármilyen típusú adatra használható - Első találat szabály def matchtest(x: Any): Any = x match { case => "one" case "two" => 2 case a: Int if (a > 100) => a - 3 case b: Int => b + 3 case _ => "None of above"

16 Option def div(a:int)(b:int):option[int] = if (b <= 0) None else if (a < b) Some(0) else Some(1 + div(a - b)(b).get) div(25)(5) div(150)(2) div(13)(4) div(13)(0) div(25)(-5) // => Some(5) // => Some(75) // => Some(3) // => None // => None div(13)(0) match { case Some(x) => println(x) case None => println("problems") // => prints "Problems" div(25)(5) match { case Some(x) => println(x) case None => println("problems") // => prints "5"

17 Implicit konverzió implicit def doubletoint(d: Double) = d.toint val x: Int = 42.0 //Java public <T> void javanomanifest(class<t> clazz) { //... //Scala def manifesttest[t](implicit m:manifest[t]) = { m.runtimeclass

18 Operátor túlterhelés class Complex(val real : Double, val imag : Double) { def +(that: Complex) = new Complex(this.real + that.real, this.imag + that.imag) def -(that: Complex) = new Complex(this.real - that.real, this.imag - that.imag) override def tostring = real + " + " + imag + "i" object Complex { def main(args : Array[String]) : Unit = { var a = new Complex(4.0,5.0) var b = new Complex(2.0,3.0) println(a) // i println(a + b) // i println(a - b) // i

19 Trait-ek //Hasonló a Java interfacehez trait Language { val name:string //De tartalmazhat implementációt is override def tostring = name

20 Trait-ek trait JVM { override def tostring = super.tostring + " runs on JVM" trait Static { override def tostring = super.tostring + " is Static" //A trait-ek összefűzhetők (a sorrend számít!) class Scala extends Language with JVM with Static { val name="scala" println(new Scala()) // -> "Scala runs on JVM is Static"

21 Trait-ek trait Quacking { def quack() = { println("quack quack quack!") class Duck { val version = "ACME Inc. Generic Duck v1.0" val aduck = new Duck with Quacking aduck.quack()

22 Case Class abstract class Term case class Var(name: String) extends Term case class Fun(arg: String, body: Term) extends Term case class App(f: Term, v: Term) extends Term val x1 = Var("x") val x2 = Var("x") val y1 = Var("y") println("" + x1 + " == " + x2 + " => " + (x1 == x2)) println("" + x1 + " == " + y1 + " => " + (x1 == y1)) def printterm(term: Term) { term match { case Var(n) => print(n) case Fun(x, b) => print("^" + x + ".") printterm(b) Var(x) == Var(x) => true Var(x) == Var(y) => false case App(f, v) => Console.print("(") printterm(f) print(" ") printterm(v) print(")")

23 Scala Java Interoperability class Companion { def hello() { println("hello (class)") // [1] object Companion { def hallo() { println("hallo (object)") // [2] def hello() { println("hello (object)") // [3] public class TestCompanion { public static void main(string[] args) { new Companion().hello(); // [1] Companion.hallo(); // [2] (static) Companion$.MODULE$.hello(); // [3] (static)

24 Multiline String és Beágyazott XML val somexmlinastring = """ <sammich> <bread>wheat</bread> <meat>salami</meat> <condiments> <condiment expired="true">mayo</condiment> <condiment expired="false">mustard</condiment> </condiments> </sammich> """ import scala.xml._ val somexml = <sammich> <bread>wheat</bread> <meat>salami</meat> <condiments> <condiment expired="true">mayo</condiment> <condiment expired="false">mustard</condiment> </condiments> </sammich>

25 Információk org/docu/files/scalabyexample.pdf

26 Köszönöm a figyelmet Elérhetőség: janos.haber@finesolution.hu

Analyse et Conception Formelle. Lesson 5. Crash Course on Scala

Analyse et Conception Formelle. Lesson 5. Crash Course on Scala Analyse et Conception Formelle Lesson 5 Crash Course on Scala T. Genet (ISTIC/IRISA) ACF-5 1 / 36 Bibliography Simply Scala. Online tutorial: http://www.simply.com/fr http://www.simply.com/ Programming

More information

A Scala Tutorial for Java programmers

A Scala Tutorial for Java programmers A Scala Tutorial for Java programmers Version 1.3 January 16, 2014 Michel Schinz, Philipp Haller PROGRAMMING METHODS LABORATORY EPFL SWITZERLAND 2 1 Introduction This document gives a quick introduction

More information

Scala Programming Language

Scala Programming Language Scala Programming Language Tomáš Bureš DISTRIBUTED SYSTEMS RESEARCH GROUP http://nenya.ms.mff.cuni.cz CHARLES UNIVERSITY PRAGUE Faculty of Mathematics and Physics What is Scala Programming language class-based

More information

Intruduction to Groovy & Grails programming languages beyond Java

Intruduction to Groovy & Grails programming languages beyond Java Intruduction to Groovy & Grails programming languages beyond Java 1 Groovy, what is it? Groovy is a relatively new agile dynamic language for the Java platform exists since 2004 belongs to the family of

More information

COSC282 BIG DATA ANALYTICS FALL 2015 LECTURE 2 - SEP 9

COSC282 BIG DATA ANALYTICS FALL 2015 LECTURE 2 - SEP 9 COSC282 BIG DATA ANALYTICS FALL 2015 LECTURE 2 - SEP 9 1 HOW WAS YOUR WEEKEND? Image source: http://www.liverunsparkle.com/ its-a-long-weekend-up-in-here/ 1. Read and Post on Piazza 2. Installed JDK &

More information

Tutorial on Writing Modular Programs in Scala

Tutorial on Writing Modular Programs in Scala Tutorial on Writing Modular Programs in Scala Martin Odersky and Gilles Dubochet 13 September 2006 Tutorial on Writing Modular Programs in Scala Martin Odersky and Gilles Dubochet 1 of 45 Welcome to the

More information

Inheritance, overloading and overriding

Inheritance, overloading and overriding Inheritance, overloading and overriding Recall with inheritance the behavior and data associated with the child classes are always an extension of the behavior and data associated with the parent class

More information

How To Write A Program In Java (Programming) On A Microsoft Macbook Or Ipad (For Pc) Or Ipa (For Mac) (For Microsoft) (Programmer) (Or Mac) Or Macbook (For

How To Write A Program In Java (Programming) On A Microsoft Macbook Or Ipad (For Pc) Or Ipa (For Mac) (For Microsoft) (Programmer) (Or Mac) Or Macbook (For Projet Java Responsables: Ocan Sankur, Guillaume Scerri (LSV, ENS Cachan) Objectives - Apprendre à programmer en Java - Travailler à plusieurs sur un gros projet qui a plusieurs aspects: graphisme, interface

More information

Hadoop + Clojure. Hadoop World NYC Friday, October 2, 2009. Stuart Sierra, AltLaw.org

Hadoop + Clojure. Hadoop World NYC Friday, October 2, 2009. Stuart Sierra, AltLaw.org Hadoop + Clojure Hadoop World NYC Friday, October 2, 2009 Stuart Sierra, AltLaw.org JVM Languages Functional Object Oriented Native to the JVM Clojure Scala Groovy Ported to the JVM Armed Bear CL Kawa

More information

Kotlin for Android Developers

Kotlin for Android Developers Kotlin for Android Developers Learn Kotlin in an easy way while developing an Android App Antonio Leiva This book is for sale at http://leanpub.com/kotlin-for-android-developers This version was published

More information

Introduction to Object-Oriented Programming

Introduction to Object-Oriented Programming Introduction to Object-Oriented Programming Programs and Methods Christopher Simpkins chris.simpkins@gatech.edu CS 1331 (Georgia Tech) Programs and Methods 1 / 8 The Anatomy of a Java Program It is customary

More information

Introduction to Java

Introduction to Java Introduction to Java The HelloWorld program Primitive data types Assignment and arithmetic operations User input Conditional statements Looping Arrays CSA0011 Matthew Xuereb 2008 1 Java Overview A high

More information

Scala Actors Library. Robert Hilbrich

Scala Actors Library. Robert Hilbrich Scala Actors Library Robert Hilbrich Foreword and Disclaimer I am not going to teach you Scala. However, I want to: Introduce a library Explain what I use it for My Goal is to: Give you a basic idea about

More information

Introduction to Java. CS 3: Computer Programming in Java

Introduction to Java. CS 3: Computer Programming in Java Introduction to Java CS 3: Computer Programming in Java Objectives Begin with primitive data types Create a main class with helper methods Learn how to call built-in class methods and instance methods

More information

java Features Version April 19, 2013 by Thorsten Kracht

java Features Version April 19, 2013 by Thorsten Kracht java Features Version April 19, 2013 by Thorsten Kracht Contents 1 Introduction 2 1.1 Hello World................................................ 2 2 Variables, Types 3 3 Input/Output 4 3.1 Standard I/O................................................

More information

Preet raj Core Java and Databases CS4PR. Time Allotted: 3 Hours. Final Exam: Total Possible Points 75

Preet raj Core Java and Databases CS4PR. Time Allotted: 3 Hours. Final Exam: Total Possible Points 75 Preet raj Core Java and Databases CS4PR Time Allotted: 3 Hours Final Exam: Total Possible Points 75 Q1. What is difference between overloading and overriding? 10 points a) In overloading, there is a relationship

More information

Yosemite National Park, California. CSE 114 Computer Science I Inheritance

Yosemite National Park, California. CSE 114 Computer Science I Inheritance Yosemite National Park, California CSE 114 Computer Science I Inheritance Containment A class contains another class if it instantiates an object of that class HAS-A also called aggregation PairOfDice

More information

Masters programmes in Computer Science and Information Systems. Object-Oriented Design and Programming. Sample module entry test xxth December 2013

Masters programmes in Computer Science and Information Systems. Object-Oriented Design and Programming. Sample module entry test xxth December 2013 Masters programmes in Computer Science and Information Systems Object-Oriented Design and Programming Sample module entry test xxth December 2013 This sample paper has more questions than the real paper

More information

Overview. Elements of Programming Languages. Advanced constructs. Motivating inner class example

Overview. Elements of Programming Languages. Advanced constructs. Motivating inner class example Overview Elements of Programming Languages Lecture 12: Object-oriented functional programming James Cheney University of Edinburgh November 6, 2015 We ve now covered: basics of functional and imperative

More information

J a v a Quiz (Unit 3, Test 0 Practice)

J a v a Quiz (Unit 3, Test 0 Practice) Computer Science S-111a: Intensive Introduction to Computer Science Using Java Handout #11 Your Name Teaching Fellow J a v a Quiz (Unit 3, Test 0 Practice) Multiple-choice questions are worth 2 points

More information

CS 106 Introduction to Computer Science I

CS 106 Introduction to Computer Science I CS 106 Introduction to Computer Science I 01 / 21 / 2014 Instructor: Michael Eckmann Today s Topics Introduction Homework assignment Review the syllabus Review the policies on academic dishonesty and improper

More information

Free Java textbook available online. Introduction to the Java programming language. Compilation. A simple java program

Free Java textbook available online. Introduction to the Java programming language. Compilation. A simple java program Free Java textbook available online "Thinking in Java" by Bruce Eckel, 4th edition, 2006, ISBN 0131872486, Pearson Education Introduction to the Java programming language CS 4354 Summer II 2015 The third

More information

Java CPD (I) Frans Coenen Department of Computer Science

Java CPD (I) Frans Coenen Department of Computer Science Java CPD (I) Frans Coenen Department of Computer Science Content Session 1, 12:45-14:30 (First Java Programme, Inheritance, Arithmetic) Session 2, 14:45-16:45 (Input and Programme Constructs) Materials

More information

Free Java textbook available online. Introduction to the Java programming language. Compilation. A simple java program

Free Java textbook available online. Introduction to the Java programming language. Compilation. A simple java program Free Java textbook available online "Thinking in Java" by Bruce Eckel, 4th edition, 2006, ISBN 0131872486, Pearson Education Introduction to the Java programming language CS 4354 Summer II 2014 Jill Seaman

More information

Chapter 1 Java Program Design and Development

Chapter 1 Java Program Design and Development presentation slides for JAVA, JAVA, JAVA Object-Oriented Problem Solving Third Edition Ralph Morelli Ralph Walde Trinity College Hartford, CT published by Prentice Hall Java, Java, Java Object Oriented

More information

1001ICT Introduction To Programming Lecture Notes

1001ICT Introduction To Programming Lecture Notes 1001ICT Introduction To Programming Lecture Notes School of Information and Communication Technology Griffith University Semester 2, 2015 1 3 A First MaSH Program In this section we will describe a very

More information

LAB4 Making Classes and Objects

LAB4 Making Classes and Objects LAB4 Making Classes and Objects Objective The main objective of this lab is class creation, how its constructer creation, object creation and instantiation of objects. We will use the definition pane to

More information

Object-Oriented Programming in Java

Object-Oriented Programming in Java CSCI/CMPE 3326 Object-Oriented Programming in Java Class, object, member field and method, final constant, format specifier, file I/O Dongchul Kim Department of Computer Science University of Texas Rio

More information

First Java Programs. V. Paúl Pauca. CSC 111D Fall, 2015. Department of Computer Science Wake Forest University. Introduction to Computer Science

First Java Programs. V. Paúl Pauca. CSC 111D Fall, 2015. Department of Computer Science Wake Forest University. Introduction to Computer Science First Java Programs V. Paúl Pauca Department of Computer Science Wake Forest University CSC 111D Fall, 2015 Hello World revisited / 8/23/15 The f i r s t o b l i g a t o r y Java program @author Paul Pauca

More information

Java Cheatsheet. http://introcs.cs.princeton.edu/java/11cheatsheet/ Tim Coppieters Laure Philips Elisa Gonzalez Boix

Java Cheatsheet. http://introcs.cs.princeton.edu/java/11cheatsheet/ Tim Coppieters Laure Philips Elisa Gonzalez Boix Java Cheatsheet http://introcs.cs.princeton.edu/java/11cheatsheet/ Tim Coppieters Laure Philips Elisa Gonzalez Boix Hello World bestand genaamd HelloWorld.java naam klasse main methode public class HelloWorld

More information

Introduction to Java Lecture Notes. Ryan Dougherty redoughe@asu.edu

Introduction to Java Lecture Notes. Ryan Dougherty redoughe@asu.edu 1 Introduction to Java Lecture Notes Ryan Dougherty redoughe@asu.edu Table of Contents 1 Versions....................................................................... 2 2 Introduction...................................................................

More information

PostgreSQL Functions By Example

PostgreSQL Functions By Example Postgre joe.conway@credativ.com credativ Group January 20, 2012 What are Functions? Introduction Uses Varieties Languages Full fledged SQL objects Many other database objects are implemented with them

More information

COSC 1020 3.0 Introduction to Computer Science I Section A, Summer 2005. Question Out of Mark A Total 16. B-1 7 B-2 4 B-3 4 B-4 4 B Total 19

COSC 1020 3.0 Introduction to Computer Science I Section A, Summer 2005. Question Out of Mark A Total 16. B-1 7 B-2 4 B-3 4 B-4 4 B Total 19 Term Test #2 COSC 1020 3.0 Introduction to Computer Science I Section A, Summer 2005 Family Name: Given Name(s): Student Number: Question Out of Mark A Total 16 B-1 7 B-2 4 B-3 4 B-4 4 B Total 19 C-1 4

More information

Handout 1. Introduction to Java programming language. Java primitive types and operations. Reading keyboard Input using class Scanner.

Handout 1. Introduction to Java programming language. Java primitive types and operations. Reading keyboard Input using class Scanner. Handout 1 CS603 Object-Oriented Programming Fall 15 Page 1 of 11 Handout 1 Introduction to Java programming language. Java primitive types and operations. Reading keyboard Input using class Scanner. Java

More information

CS1002: COMPUTER SCIENCE OO MODELLING & DESIGN: WEEK 5

CS1002: COMPUTER SCIENCE OO MODELLING & DESIGN: WEEK 5 This Week CS1002: COMPUTER SCIENCE OO MODELLING & DESIGN: WEEK 5 School of Computer Science University of St Andrews Graham Kirby Alan Dearle More on Java classes Constructors Modifiers cdn.videogum.com/img/thumbnails/photos/commenter.jpg

More information

Web Service Caching Using Command Cache

Web Service Caching Using Command Cache Web Service Caching Using Command Cache Introduction Caching can be done at Server Side or Client Side. This article focuses on server side caching of web services using command cache. This article will

More information

CSE 1223: Introduction to Computer Programming in Java Chapter 2 Java Fundamentals

CSE 1223: Introduction to Computer Programming in Java Chapter 2 Java Fundamentals CSE 1223: Introduction to Computer Programming in Java Chapter 2 Java Fundamentals 1 Recall From Last Time: Java Program import java.util.scanner; public class EggBasket { public static void main(string[]

More information

Sample CSE8A midterm Multiple Choice (circle one)

Sample CSE8A midterm Multiple Choice (circle one) Sample midterm Multiple Choice (circle one) (2 pts) Evaluate the following Boolean expressions and indicate whether short-circuiting happened during evaluation: Assume variables with the following names

More information

Dozer v.5.5.1 User's Guide

Dozer v.5.5.1 User's Guide ... Dozer v.5.5.1 User's Guide... Franz Garsombke, Matt Tierney, Dmitry Buzdin 2014-04-22 T a b l e o f C o n t e n t s i Table of Contents... 1. Table of Contents...........................................................

More information

Java Crash Course Part I

Java Crash Course Part I Java Crash Course Part I School of Business and Economics Institute of Information Systems HU-Berlin WS 2005 Sebastian Kolbe skolbe@wiwi.hu-berlin.de Overview (Short) introduction to the environment Linux

More information

qwertyuiopasdfghjklzxcvbnmqwerty uiopasdfghjklzxcvbnmqwertyuiopasd fghjklzxcvbnmqwertyuiopasdfghjklzx cvbnmqwertyuiopasdfghjklzxcvbnmq

qwertyuiopasdfghjklzxcvbnmqwerty uiopasdfghjklzxcvbnmqwertyuiopasd fghjklzxcvbnmqwertyuiopasdfghjklzx cvbnmqwertyuiopasdfghjklzxcvbnmq qwertyuiopasdfghjklzxcvbnmqwerty uiopasdfghjklzxcvbnmqwertyuiopasd fghjklzxcvbnmqwertyuiopasdfghjklzx cvbnmqwertyuiopasdfghjklzxcvbnmq Introduction to Programming using Java wertyuiopasdfghjklzxcvbnmqwertyui

More information

Object-Oriented Design Lecture 4 CSU 370 Fall 2007 (Pucella) Tuesday, Sep 18, 2007

Object-Oriented Design Lecture 4 CSU 370 Fall 2007 (Pucella) Tuesday, Sep 18, 2007 Object-Oriented Design Lecture 4 CSU 370 Fall 2007 (Pucella) Tuesday, Sep 18, 2007 The Java Type System By now, you have seen a fair amount of Java. Time to study in more depth the foundations of the language,

More information

Getting t Ge o K tting t no o K w Scala no for fo r Da D t a a t a Sc S i c e i n e c n e c @TheTomFlaherty

Getting t Ge o K tting t no o K w Scala no for fo r Da D t a a t a Sc S i c e i n e c n e c @TheTomFlaherty Getting to Know Scala for Data Science @TheTomFlaherty Bio: I have been a Chief Architect for 20 years, where I first become enamored by Scala in 2006. I wrote a symbolic math application in Scala at Glaxo

More information

Cross Platform App Development

Cross Platform App Development Cross Platform App Development a technical overview Heiko Behrens #OOP2011 @HBehrens I want an iphone App! diversity of platforms 94 App Stores two categories How can we address this diversity? You can

More information

Collections.sort(population); // Método de ordenamiento

Collections.sort(population); // Método de ordenamiento import java.util.collections; import java.util.linkedlist; import java.util.random; public class GeneticAlgorithms static long BEGIN; static final boolean _DEBUG = true; LinkedList population

More information

Object-Oriented Programming in Java

Object-Oriented Programming in Java Object-Oriented Programming in Java Quiz 1 Jan 10, 2001 Problem 1: Who wants to be a Java developer? (with apologies to Regis) Fill in your answer in the space provided. Question 1: Which is these word-pairs

More information

The Java Virtual Machine and Mobile Devices. John Buford, Ph.D. buford@alum.mit.edu Oct 2003 Presented to Gordon College CS 311

The Java Virtual Machine and Mobile Devices. John Buford, Ph.D. buford@alum.mit.edu Oct 2003 Presented to Gordon College CS 311 The Java Virtual Machine and Mobile Devices John Buford, Ph.D. buford@alum.mit.edu Oct 2003 Presented to Gordon College CS 311 Objectives Review virtual machine concept Introduce stack machine architecture

More information

WA2099 Introduction to Java using RAD 8.0 EVALUATION ONLY. Student Labs. Web Age Solutions Inc.

WA2099 Introduction to Java using RAD 8.0 EVALUATION ONLY. Student Labs. Web Age Solutions Inc. WA2099 Introduction to Java using RAD 8.0 Student Labs Web Age Solutions Inc. 1 Table of Contents Lab 1 - The HelloWorld Class...3 Lab 2 - Refining The HelloWorld Class...20 Lab 3 - The Arithmetic Class...25

More information

Ruby - A Brief History

Ruby - A Brief History Ruby on Rails 4 Web development workshop Rick Pannen, Consulting & Development [ pannen@gmail.com ] The history of Ruby A scripting language like perl or python Developed by Yukihiro Matz Matsumoto in

More information

Basic Java Constructs and Data Types Nuts and Bolts. Looking into Specific Differences and Enhancements in Java compared to C

Basic Java Constructs and Data Types Nuts and Bolts. Looking into Specific Differences and Enhancements in Java compared to C Basic Java Constructs and Data Types Nuts and Bolts Looking into Specific Differences and Enhancements in Java compared to C 1 Contents Hello World Program Statements Explained Java Program Structure in

More information

Data Structures Lecture 1

Data Structures Lecture 1 Fall 2015 Fang Yu Software Security Lab. Dept. Management Information Systems, National Chengchi University Data Structures Lecture 1 A brief review of Java programming Popularity of Programming Languages

More information

AP Computer Science Static Methods, Strings, User Input

AP Computer Science Static Methods, Strings, User Input AP Computer Science Static Methods, Strings, User Input Static Methods The Math class contains a special type of methods, called static methods. A static method DOES NOT operate on an object. This is because

More information

1) Which of the following is a constant, according to Java naming conventions? a. PI b. Test c. x d. radius

1) Which of the following is a constant, according to Java naming conventions? a. PI b. Test c. x d. radius Programming Concepts Practice Test 1 1) Which of the following is a constant, according to Java naming conventions? a. PI b. Test c. x d. radius 2) Consider the following statement: System.out.println("1

More information

C:\Documents and Settings\Gijs\Desktop\src\client\Client.java dinsdag 3 november 2009 10:50

C:\Documents and Settings\Gijs\Desktop\src\client\Client.java dinsdag 3 november 2009 10:50 C:\Documents and Settings\Gijs\Desktop\src\client\Client.java dinsdag 3 november 2009 10:50 package client; import hotel.bookingconstraints; import hotel.bookingexception; import hotel.costumersessionremote;

More information

GContracts Programming by Contract with Groovy. Andre Steingress

GContracts Programming by Contract with Groovy. Andre Steingress FÕ Ò ŃÔ PŎ ÑŇÒ P ÌM Œ PÑǾ PÒ PÕ Ñ Œ PŘÕ Ñ GContracts Programming by Contract with Groovy Andre Steingress Andre FÕ Ò ŃÔ PŎ ÑŇÒ P ÌM Œ PSteingress ÑǾ PÒ PÕ Ñ Œ PŘÕ Ñ Independent Software Dev @sternegross,

More information

Java with Eclipse: Setup & Getting Started

Java with Eclipse: Setup & Getting Started Java with Eclipse: Setup & Getting Started Originals of slides and source code for examples: http://courses.coreservlets.com/course-materials/java.html Also see Java 8 tutorial: http://www.coreservlets.com/java-8-tutorial/

More information

JDK 1.5 Updates for Introduction to Java Programming with SUN ONE Studio 4

JDK 1.5 Updates for Introduction to Java Programming with SUN ONE Studio 4 JDK 1.5 Updates for Introduction to Java Programming with SUN ONE Studio 4 NOTE: SUN ONE Studio is almost identical with NetBeans. NetBeans is open source and can be downloaded from www.netbeans.org. I

More information

Building Java Programs

Building Java Programs Building Java Programs Chapter 3 Lecture 3-3: Interactive Programs w/ Scanner reading: 3.3-3.4 self-check: #16-19 exercises: #11 videos: Ch. 3 #4 Interactive programs We have written programs that print

More information

Lab 1A. Create a simple Java application using JBuilder. Part 1: make the simplest Java application Hello World 1. Start Jbuilder. 2.

Lab 1A. Create a simple Java application using JBuilder. Part 1: make the simplest Java application Hello World 1. Start Jbuilder. 2. Lab 1A. Create a simple Java application using JBuilder In this lab exercise, we ll learn how to use a Java integrated development environment (IDE), Borland JBuilder 2005, to develop a simple Java application

More information

14/05/2013 Ed Merks EDL V1.0 1

14/05/2013 Ed Merks EDL V1.0 1 14/05/2013 Ed Merks EDL V1.0 1 Java Performance is Complex Write once run everywhere Java is slow because it s interpreted No, there are Just In Time (JIT) compilers Different hardware and platforms Different

More information

WHAT ARE PACKAGES? A package is a collection of related classes. This is similar to the notion that a class is a collection of related methods.

WHAT ARE PACKAGES? A package is a collection of related classes. This is similar to the notion that a class is a collection of related methods. Java Packages KNOWLEDGE GOALS Understand what a package does. Organizes large collections of Java classes Provides access control for variables and methods using the modifier 'protected' Helps manage large

More information

JAVA - METHODS. Method definition consists of a method header and a method body. The same is shown below:

JAVA - METHODS. Method definition consists of a method header and a method body. The same is shown below: http://www.tutorialspoint.com/java/java_methods.htm JAVA - METHODS Copyright tutorialspoint.com A Java method is a collection of statements that are grouped together to perform an operation. When you call

More information

Scaling Up & Out with Actors: Introducing Akka

Scaling Up & Out with Actors: Introducing Akka Scaling Up & Out with Actors: Introducing Akka Akka Tech Lead Email: viktor.klang@typesafe.com Twitter: @viktorklang The problem It is way too hard to build: 1. correct highly concurrent systems 2. truly

More information

Install Java Development Kit (JDK) 1.8 http://www.oracle.com/technetwork/java/javase/downloads/index.html

Install Java Development Kit (JDK) 1.8 http://www.oracle.com/technetwork/java/javase/downloads/index.html CS 259: Data Structures with Java Hello World with the IntelliJ IDE Instructor: Joel Castellanos e-mail: joel.unm.edu Web: http://cs.unm.edu/~joel/ Office: Farris Engineering Center 319 8/19/2015 Install

More information

CSE 1223: Introduction to Computer Programming in Java Chapter 7 File I/O

CSE 1223: Introduction to Computer Programming in Java Chapter 7 File I/O CSE 1223: Introduction to Computer Programming in Java Chapter 7 File I/O 1 Sending Output to a (Text) File import java.util.scanner; import java.io.*; public class TextFileOutputDemo1 public static void

More information

JAVA - MULTITHREADING

JAVA - MULTITHREADING JAVA - MULTITHREADING http://www.tutorialspoint.com/java/java_multithreading.htm Copyright tutorialspoint.com Java is amulti threaded programming language which means we can develop multi threaded program

More information

2! Multimedia Programming with! Python and SDL

2! Multimedia Programming with! Python and SDL 2 Multimedia Programming with Python and SDL 2.1 Introduction to Python 2.2 SDL/Pygame: Multimedia/Game Frameworks for Python Literature: G. van Rossum and F. L. Drake, Jr., An Introduction to Python -

More information

Classes: Relationships Among Objects. Atul Prakash Background readings: Chapters 8-11 (Downey)

Classes: Relationships Among Objects. Atul Prakash Background readings: Chapters 8-11 (Downey) Classes: Relationships Among Objects Atul Prakash Background readings: Chapters 8-11 (Downey) Real-World Relationships: Parent-child relationships among members of a species Friends relationship among

More information

Big Data for the JVM developer. Costin Leau, Elasticsearch @costinl

Big Data for the JVM developer. Costin Leau, Elasticsearch @costinl Big Data for the JVM developer Costin Leau, Elasticsearch @costinl Agenda Data Trends Data Pipelines JVM and Big Data Tool Eco-system Data Landscape Data Trends http://www.emc.com/leadership/programs/digital-universe.htm

More information

Component Abstractions in Scala The Basics

Component Abstractions in Scala The Basics Component Abstractions in Scala The Basics LASER Summer School, 2012 Martin Odersky Typesafe and EPFL A Paradigm Shift The world of software is changing because of hardware trends. Moore s law now achieved

More information

Habanero Extreme Scale Software Research Project

Habanero Extreme Scale Software Research Project Habanero Extreme Scale Software Research Project Comp215: Java Method Dispatch Zoran Budimlić (Rice University) Always remember that you are absolutely unique. Just like everyone else. - Margaret Mead

More information

Kotlin for Android Developers (Preview)

Kotlin for Android Developers (Preview) Kotlin for Android Developers (Preview) Learn Kotlin in an easy way while developing an Android App Antonio Leiva Kotlin for Android Developers (Preview) Learn Kotlin in an easy way while developing an

More information

INF 212 ANALYSIS OF PROG. LANGS ADVERSITY. Instructors: Crista Lopes Copyright Instructors.

INF 212 ANALYSIS OF PROG. LANGS ADVERSITY. Instructors: Crista Lopes Copyright Instructors. INF 212 ANALYSIS OF PROG. LANGS ADVERSITY Instructors: Crista Lopes Copyright Instructors. random quotes. just because We have forty million reasons for failure, but not a single excuse. It's fine to celebrate

More information

LAB 1. Familiarization of Rational Rose Environment And UML for small Java Application Development

LAB 1. Familiarization of Rational Rose Environment And UML for small Java Application Development LAB 1 Familiarization of Rational Rose Environment And UML for small Java Application Development OBJECTIVE AND BACKGROUND The purpose of this first UML lab is to familiarize programmers with Rational

More information

public void setusername(string username) { this.username = username; } public void setname(string name) { this.name = name; }

public void setusername(string username) { this.username = username; } public void setname(string name) { this.name = name; } User-klassen package domain; import dk.au.hum.imv.persistence.db.databasepersistent; public class User extends DatabasePersistent { private String username; private String name; private String address;

More information

CS 141: Introduction to (Java) Programming: Exam 1 Jenny Orr Willamette University Fall 2013

CS 141: Introduction to (Java) Programming: Exam 1 Jenny Orr Willamette University Fall 2013 Oct 4, 2013, p 1 Name: CS 141: Introduction to (Java) Programming: Exam 1 Jenny Orr Willamette University Fall 2013 1. (max 18) 4. (max 16) 2. (max 12) 5. (max 12) 3. (max 24) 6. (max 18) Total: (max 100)

More information

Building Java Programs

Building Java Programs Building Java Programs Chapter 3 Lecture 3-3: Interactive Programs w/ Scanner reading: 3.3-3.4 self-check: #16-19 exercises: #11 videos: Ch. 3 #4 Interactive programs We have written programs that print

More information

Problem 1 (1.5 points)

Problem 1 (1.5 points) Leganés, June 17th, 2014 Time: 120 min Systems Programming Extraordinary Call (Problems) Grade: 5 points out of 10 from the exam Problem 1 (1.5 points) City councils apply two types of municipal taxes

More information

Java Programming Fundamentals

Java Programming Fundamentals Lecture 1 Part I Java Programming Fundamentals Topics in Quantitative Finance: Numerical Solutions of Partial Differential Equations Instructor: Iraj Kani Introduction to Java We start by making a few

More information

Java Memory Model: Content

Java Memory Model: Content Java Memory Model: Content Memory Models Double Checked Locking Problem Java Memory Model: Happens Before Relation Volatile: in depth 16 March 2012 1 Java Memory Model JMM specifies guarantees given by

More information

Word Count Code using MR2 Classes and API

Word Count Code using MR2 Classes and API EDUREKA Word Count Code using MR2 Classes and API A Guide to Understand the Execution of Word Count edureka! A guide to understand the execution and flow of word count WRITE YOU FIRST MRV2 PROGRAM AND

More information

System.out.println("\nEnter Product Number 1-5 (0 to stop and view summary) :

System.out.println(\nEnter Product Number 1-5 (0 to stop and view summary) : Benjamin Michael Java Homework 3 10/31/2012 1) Sales.java Code // Sales.java // Program calculates sales, based on an input of product // number and quantity sold import java.util.scanner; public class

More information

AP Computer Science Java Subset

AP Computer Science Java Subset APPENDIX A AP Computer Science Java Subset The AP Java subset is intended to outline the features of Java that may appear on the AP Computer Science A Exam. The AP Java subset is NOT intended as an overall

More information

Getting Started with the Internet Communications Engine

Getting Started with the Internet Communications Engine Getting Started with the Internet Communications Engine David Vriezen April 7, 2014 Contents 1 Introduction 2 2 About Ice 2 2.1 Proxies................................. 2 3 Setting Up ICE 2 4 Slices 2

More information

STORM. Simulation TOol for Real-time Multiprocessor scheduling. Designer Guide V3.3.1 September 2009

STORM. Simulation TOol for Real-time Multiprocessor scheduling. Designer Guide V3.3.1 September 2009 STORM Simulation TOol for Real-time Multiprocessor scheduling Designer Guide V3.3.1 September 2009 Richard Urunuela, Anne-Marie Déplanche, Yvon Trinquet This work is part of the project PHERMA supported

More information

Chapter 2: Elements of Java

Chapter 2: Elements of Java Chapter 2: Elements of Java Basic components of a Java program Primitive data types Arithmetic expressions Type casting. The String type (introduction) Basic I/O statements Importing packages. 1 Introduction

More information

Topics. Introduction. Java History CS 146. Introduction to Programming and Algorithms Module 1. Module Objectives

Topics. Introduction. Java History CS 146. Introduction to Programming and Algorithms Module 1. Module Objectives Introduction to Programming and Algorithms Module 1 CS 146 Sam Houston State University Dr. Tim McGuire Module Objectives To understand: the necessity of programming, differences between hardware and software,

More information

Writing Standalone Spark Programs

Writing Standalone Spark Programs Writing Standalone Spark Programs Matei Zaharia UC Berkeley www.spark- project.org UC BERKELEY Outline Setting up for Spark development Example: PageRank PageRank in Java Testing and debugging Building

More information

CS 1302 Ch 19, Binary I/O

CS 1302 Ch 19, Binary I/O CS 1302 Ch 19, Binary I/O Sections Pages Review Questions Programming Exercises 19.1-19.4.1, 19.6-19.6 710-715, 724-729 Liang s Site any Sections 19.1 Introduction 1. An important part of programming is

More information

CompSci 125 Lecture 08. Chapter 5: Conditional Statements Chapter 4: return Statement

CompSci 125 Lecture 08. Chapter 5: Conditional Statements Chapter 4: return Statement CompSci 125 Lecture 08 Chapter 5: Conditional Statements Chapter 4: return Statement Homework Update HW3 Due 9/20 HW4 Due 9/27 Exam-1 10/2 Programming Assignment Update p1: Traffic Applet due Sept 21 (Submit

More information

Implementing Rexx Handlers in NetRexx/Java/Rexx

Implementing Rexx Handlers in NetRexx/Java/Rexx Institut für Betriebswirtschaftslehre und Wirtschaftsinformatik Implementing Rexx Handlers in NetRexx/Java/Rexx The 2012 International Rexx Symposium Rony G. Flatscher Wirtschaftsuniversität Wien Augasse

More information

http://algs4.cs.princeton.edu dictionary find definition word definition book index find relevant pages term list of page numbers

http://algs4.cs.princeton.edu dictionary find definition word definition book index find relevant pages term list of page numbers ROBERT SEDGEWICK KEVI WAYE F O U R T H E D I T I O ROBERT SEDGEWICK KEVI WAYE ROBERT SEDGEWICK KEVI WAYE Symbol tables Symbol table applications Key-value pair abstraction. Insert a value with specified.

More information

Simple Java Applications

Simple Java Applications Chapter 2 Simple Java Applications 2.1 An Application and its Architecture 2.2 How to Build and Execute an Application 2.2.1 Using an IDE 2.2.2 Using the JDK 2.3 How the Application Works 2.3.1 An Execution

More information

Custom SIS Integration Type Development. Jim Riecken (jim.riecken@blackboard.com) Blackboard Learn Product Development

Custom SIS Integration Type Development. Jim Riecken (jim.riecken@blackboard.com) Blackboard Learn Product Development Custom SIS Integration Type Development Jim Riecken (jim.riecken@blackboard.com) Blackboard Learn Product Development Outline What is the Student Information System (SIS) Integration framework? How does

More information

Programming Languages CIS 443

Programming Languages CIS 443 Course Objectives Programming Languages CIS 443 0.1 Lexical analysis Syntax Semantics Functional programming Variable lifetime and scoping Parameter passing Object-oriented programming Continuations Exception

More information

Scala type classes and machine learning. David Andrzejewski Bay Area Scala Enthusiasts - 1/14/2013, 1/16/2013

Scala type classes and machine learning. David Andrzejewski Bay Area Scala Enthusiasts - 1/14/2013, 1/16/2013 Scala type classes and machine learning David Andrzejewski Bay Area Scala Enthusiasts - 1/14/2013, 1/16/2013 Context: Sumo Logic Mission: Transform Machine Data into IT and Business Insights Offering:

More information

Konzepte objektorientierter Programmierung

Konzepte objektorientierter Programmierung Konzepte objektorientierter Programmierung Prof. Dr. Peter Müller Werner Dietl Software Component Technology Exercises 3: Some More OO Languages Wintersemester 04/05 Agenda for Today 2 Homework Finish

More information

cs2010: algorithms and data structures

cs2010: algorithms and data structures cs2010: algorithms and data structures Lecture 11: Symbol Table ADT. Vasileios Koutavas 28 Oct 2015 School of Computer Science and Statistics Trinity College Dublin Algorithms ROBERT SEDGEWICK KEVIN WAYNE

More information

Hadoop Framework. technology basics for data scientists. Spring - 2014. Jordi Torres, UPC - BSC www.jorditorres.eu @JordiTorresBCN

Hadoop Framework. technology basics for data scientists. Spring - 2014. Jordi Torres, UPC - BSC www.jorditorres.eu @JordiTorresBCN Hadoop Framework technology basics for data scientists Spring - 2014 Jordi Torres, UPC - BSC www.jorditorres.eu @JordiTorresBCN Warning! Slides are only for presenta8on guide We will discuss+debate addi8onal

More information