Groovy For Java Programmers

Size: px
Start display at page:

Download "Groovy For Java Programmers"

Transcription

1 Groovy For Java Programmers QCONSF 2010 Jeff Brown Core Grails Developer SpringSource - A Division Of VMware Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited.

2 What Is Groovy? Agile Dynamic Language For The JVM Inspired By Languages Such As... Python Ruby Smalltalk 2

3 Why Groovy Powerful Dynamic Language Relatively Easy To Learn Familiar Syntax For Java Programmers Integrates Really Well With Java Containers, Libraries, Existing Java Code 3

4 Installing Groovy Download Latest Release Extract Archive Set $GROOVY_HOME Add $GROOVY_HOME/bin to PATH 4

5 Groovy Tools groovy - Interpreter groovyc - Compiler groovysh - Shell groovyconsole - Swing Console 5

6 Give It A Spin $ groovy -version Groovy Version: JVM: 1.5.0_ $ groovy -e "println 'Groovy Rocks.'" Groovy Rocks. $ groovy -e "x=5; y=10; z=x*y; println z" 50 6

7 groovysh 7

8 groovyconsole 8

9 Groovy Class more on Groovy properties later... 9

10 Groovy Scripts Scripts Do Not Require A Class Definition no main method 10

11 Print Independence Day // PrintIndependenceDay.java import java.util.calendar; import java.util.date; public class PrintIndependenceDay { public static void main(string[] args) { Calendar calendar = Calendar.getInstance(); calendar.clear(); calendar.set(calendar.month, Calendar.JULY); calendar.set(calendar.date, 4); calendar.set(calendar.year, 1776); Date time = calendar.gettime(); } } System.out.println(time); 11

12 Print Independence Day // PrintIndependenceDay.groovy import java.util.calendar; import java.util.date; public class PrintIndependenceDay { public static void main(string[] args) { Calendar calendar = Calendar.getInstance(); calendar.clear(); calendar.set(calendar.month, Calendar.JULY); calendar.set(calendar.date, 4); calendar.set(calendar.year, 1776); Date time = calendar.gettime(); } } System.out.println(time); 12

13 No Utility Imports... // PrintIndependenceDay.groovy public class PrintIndependenceDay { public static void main(string[] args) { Calendar calendar = Calendar.getInstance(); calendar.clear(); calendar.set(calendar.month, Calendar.JULY); calendar.set(calendar.date, 4); calendar.set(calendar.year, 1776); Date time = calendar.gettime(); } } System.out.println(time); 13

14 No Semicolons... // PrintIndependenceDay.groovy public class PrintIndependenceDay { public static void main(string[] args) { Calendar calendar = Calendar.getInstance() calendar.clear() calendar.set(calendar.month, Calendar.JULY) calendar.set(calendar.date, 4) calendar.set(calendar.year, 1776) Date time = calendar.gettime() } } System.out.println(time) 14

15 No Getters... // PrintIndependenceDay.groovy public class PrintIndependenceDay { public static void main(string[] args) { Calendar calendar = Calendar.instance calendar.clear() calendar.set(calendar.month, Calendar.JULY) calendar.set(calendar.date, 4) calendar.set(calendar.year, 1776) Date time = calendar.time } } System.out.println(time) 15

16 No Static Typing... // PrintIndependenceDay.groovy public class PrintIndependenceDay { public static void main(string[] args) { def calendar = Calendar.instance calendar.clear() calendar.set(calendar.month, Calendar.JULY) calendar.set(calendar.date, 4) calendar.set(calendar.year, 1776) def time = calendar.time } } System.out.println(time) 16

17 No System.out.blah.blah... // PrintIndependenceDay.groovy public class PrintIndependenceDay { public static void main(string[] args) { def calendar = Calendar.instance calendar.clear() calendar.set(calendar.month, Calendar.JULY) calendar.set(calendar.date, 4) calendar.set(calendar.year, 1776) def time = calendar.time } } println(time) 17

18 No Class... // PrintIndependenceDay.groovy def calendar = Calendar.instance calendar.clear() calendar.set(calendar.month, Calendar.JULY) calendar.set(calendar.date, 4) calendar.set(calendar.year, 1776) def time = calendar.time println(time) 18

19 Optional Parens... // PrintIndependenceDay.groovy def calendar = Calendar.instance calendar.clear() calendar.set Calendar.MONTH, Calendar.JULY calendar.set Calendar.DATE, 4 calendar.set Calendar.YEAR, 1776 def time = calendar.time println time 19

20 Lets Go Meta... // PrintIndependenceDay.groovy def calendar = Calendar.instance calendar.with { clear() set MONTH, JULY set DATE, 4 set YEAR, 1776 println time } 20

21 Lets Compare... // PrintIndependenceDay.java import java.util.calendar; import java.util.date; public class PrintIndependenceDay { public static void main(string[] args) { Calendar calendar = Calendar.getInstance(); calendar.clear(); calendar.set(calendar.month, Calendar.JULY); calendar.set(calendar.date, 4); calendar.set(calendar.year, 1776); Date time = calendar.gettime(); // PrintIndependenceDay.groovy def calendar = Calendar.instance calendar.with { clear() set MONTH, JULY set DATE, 4 set YEAR, 1776 println time } } } System.out.println(time); 21

22 Everything Is An Object 22

23 Groovy Strings Single quoted Strings are java.lang.string Double quoted Strings are "GStrings" may contain embedded Groovy code 23

24 Groovy Strings Strings May Be Referenced Using [ ] 24

25 Groovy Collections Groovy Collections Are Standard java.util.collections Groovy Adds Many Useful Methods To Existing Collections Many Common Tasks Are Much More Simple In Groovy Compared To Java 25

26 Groovy List 26

27 Groovy Maps 27

28 Groovy Beans Groovy Beans / POGOs Similar To POJOs...but groovier eliminates boilerplate code 28

29 POJO 29

30 POJO 30

31 POJO Modern Java IDEs Generate Most Of That Code developer declares fields IDE generates constructors IDE generates getters/setters If the IDE can generate all of that code, why can't the compiler or the 31

32 Groovy Beans Groovy Beans Eliminate All Of The Boilerplate Code No Need To Write Getters/Setters Seldom Need To Write Constructors 32

33 Groovy Beans 33

34 Groovy Beans Property Access Looks Like Field Access 34

35 Groovy Beans 35

36 Closures A Block Of Code May Be Passed As Arguments May Accept Parameters May Return A Value Much More Powerful Than Anonymous Inner Classes 36

37 Closures Groovy Adds A 'times' Method To Number The 'times' Method Accepts A Closure As An Argument 37

38 Closures 38

39 Closures Closures May Declare An Argument List the times method is passing an argument into the closure 39

40 Closures The Implicit 'it' Argument 40

41 Closures Closures May Accept Multiple Arguments 41

42 Closures Closures Simplify Collection Iteration 42

43 Closures 43

44 Closures 44

45 Builders Builders Are A Powerful Concept Metaprogramming Makes Builders A Snap In Groovy Several Builders Are Bundled With Groovy SwingBuilder, MarkupBuilder, etc... You Can Write Your Own 45

46 MarkupBuilder 46

47 Q & A 47

Grails Seminar 11/12/09. Groovy And Grails. An Overview

Grails Seminar 11/12/09. Groovy And Grails. An Overview Grails Seminar 11/12/09 Groovy And Grails An Overview Groovy What Is Groovy? Groovy... Is A Dynamic Language For The Java Virtual Machine (JVM) Takes inspiration from Smalltalk, Python and Ruby (etc...)

More information

Jussi Riihelä / Jussi Riihelä

Jussi Riihelä / Jussi Riihelä 28.4.2006 Jussi Riihelä jussi.riihela@nokia.com 1 2006-04-28 / Jussi Riihelä Content Basic facts and motivation Groovy features IDE support and runtime dependencies Criticism 2 2006-04-28 / Jussi Riihelä

More information

Groovy A Language Introduction for Java Programmers

Groovy A Language Introduction for Java Programmers Groovy A Language Introduction for Java Programmers Eric Schreiner Managing Director Contecon Software GmbH Eric Schreiner Groovy: A Language Introduction for Java Programmers Slide 1 Other Groovy related

More information

Groovy. Extending Java with scripting capabilities. Last updated: 10 July 2017

Groovy. Extending Java with scripting capabilities. Last updated: 10 July 2017 Groovy Extending Java with scripting capabilities Last updated: 10 July 2017 Pepgo Limited, 71-75 Shelton Street, Covent Garden, London, WC2H 9JQ, United Kingdom Contents About Groovy... 3 Install Groovy...

More information

Scripting for the JVM using Groovy. Adil Khan Sr. Application Developer /Java Group Biomedical Informatics

Scripting for the JVM using Groovy. Adil Khan Sr. Application Developer /Java Group Biomedical Informatics Scripting for the JVM using Groovy Adil Khan Sr. Application Developer /Java Group Biomedical Informatics Outline What is Groovy? Outline Outline What is Groovy? Why would we want to use it? Outline What

More information

Introduction to Groovy

Introduction to Groovy Introduction to Groovy Drew Wills Lennard Fuller Jasig Spring Conference San Diego, March 7, 2010 Copyright Unicon, Inc., 2006. This work is the intellectual property of Unicon, Inc. Permission is granted

More information

Groovy & Grails Scripting for Modern Web Applications. Rohit Nayak Talentica Software

Groovy & Grails Scripting for Modern Web Applications. Rohit Nayak Talentica Software Groovy & Grails Scripting for Modern Web Applications Rohit Nayak Talentica Software Agenda Demo: Quick intro to Grails Scripting, Web Applications and Grails/Groovy REST service in Grails Demo Internals

More information

Groovy & Grails in Depth

Groovy & Grails in Depth Groovy & Grails in Depth Simplifying Java EE with Grails Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited. Speaker s qualifications Graeme

More information

Groovy, but without a cheesy presentation title...

Groovy, but without a cheesy presentation title... Groovy, but without a cheesy presentation title... Ken Rimple, Chariot Solutions! Emerging Technologies for the Enterprise 2009! All About Me...! Ken Rimple!Mentoring/Education Services lead for Chariot

More information

Getting Groovy without the bad clothes by James Williams

Getting Groovy without the bad clothes by James Williams Getting Groovy without the bad clothes by James Williams This article is released under the Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 United States License. What is Groovy? Groovy

More information

A guide to learning the popular JVM programming language, Groovy 2.x, and its ecosystem

A guide to learning the popular JVM programming language, Groovy 2.x, and its ecosystem Learning Groovy A guide to learning the popular JVM programming language, Groovy 2.x, and its ecosystem Adam L. Davis This book is for sale at http://leanpub.com/learninggroovy This version was published

More information

Groovy and Grails in Google App Engine

Groovy and Grails in Google App Engine Groovy and Grails in Google App Engine Benefit from a Java-like dynamic language to be more productive on App Engine Guillaume Laforge Head of Groovy Development Guillaume Laforge Groovy Project Manager

More information

Beginning Groovy, Grails and Griffon. Vishal Layka Christopher M. Judd Joseph Faisal Nusairat Jim Shingler

Beginning Groovy, Grails and Griffon. Vishal Layka Christopher M. Judd Joseph Faisal Nusairat Jim Shingler Beginning Groovy, Grails and Griffon Vishal Layka Christopher M. Judd Joseph Faisal Nusairat Jim Shingler Contents J About the Authors About the Technical Reviewer Acknowledgments xv xvii xix Chapter 1:

More information

Groovy Primer Chris Dail Groovy Primer (March 2010)

Groovy Primer Chris Dail  Groovy Primer (March 2010) Groovy Primer Chris Dail http://chrisdail.com Twitter: @chrisdail What is Groovy? An agile dynamic language for the Java Platform Both dynamically and statically typed Functional programming influence

More information

Closing the Case for Groovy (and Ruby, and Python)

Closing the Case for Groovy (and Ruby, and Python) Closing the Case for Groovy (and Ruby, and Python) Dr Russel Winder Concertant LLP russel.winder@concertant.com 2007 Russel Winder 1 Aims and Objectives Convince people that dynamic typing is not a difficulty,

More information

Building Grails Applications with PostgreSQL. Brent Baxter and Ken Rimple PostgreSQL East - March 25, 2010

Building Grails Applications with PostgreSQL. Brent Baxter and Ken Rimple PostgreSQL East - March 25, 2010 Building Grails Applications with PostgreSQL Brent Baxter and Ken Rimple About Brent and Ken Brent Baxter: bbaxter@chariotsolutions.com Consultant and Applications Architect Grails, Java, and Spring developer

More information

An Oracle White Paper March Introduction to Groovy Support in JDeveloper and Oracle ADF 11g

An Oracle White Paper March Introduction to Groovy Support in JDeveloper and Oracle ADF 11g An Oracle White Paper March 2009 Introduction to Groovy Support in JDeveloper and Oracle ADF 11g Oracle White Paper Introduction to Groovy support in JDeveloper and Oracle ADF 11g Introduction... 2 Introduction

More information

Notes from a Short Introductory Lecture on Scala (Based on Programming in Scala, 2nd Ed.)

Notes from a Short Introductory Lecture on Scala (Based on Programming in Scala, 2nd Ed.) Notes from a Short Introductory Lecture on Scala (Based on Programming in Scala, 2nd Ed.) David Haraburda January 30, 2013 1 Introduction Scala is a multi-paradigm language that runs on the JVM (is totally

More information

INDEX. A SIMPLE JAVA PROGRAM Class Declaration The Main Line. The Line Contains Three Keywords The Output Line

INDEX. A SIMPLE JAVA PROGRAM Class Declaration The Main Line. The Line Contains Three Keywords The Output Line A SIMPLE JAVA PROGRAM Class Declaration The Main Line INDEX The Line Contains Three Keywords The Output Line COMMENTS Single Line Comment Multiline Comment Documentation Comment TYPE CASTING Implicit Type

More information

SpringSource Tool Suite 2.7.1

SpringSource Tool Suite 2.7.1 SpringSource Tool Suite 2.7.1 - New and Noteworthy - Martin Lippert 2.7.1 July 12, 2011 Updated for 2.7.1.RELEASE ENHANCEMENTS 2.7.1 General Updates Spring Roo 1.1.5 STS now ships and works with the just

More information

1 Shyam sir JAVA Notes

1 Shyam sir JAVA Notes 1 Shyam sir JAVA Notes 1. What is the most important feature of Java? Java is a platform independent language. 2. What do you mean by platform independence? Platform independence means that we can write

More information

Classes and Objects 3/28/2017. How can multiple methods within a Java class read and write the same variable?

Classes and Objects 3/28/2017. How can multiple methods within a Java class read and write the same variable? Peer Instruction 8 Classes and Objects How can multiple methods within a Java class read and write the same variable? A. Allow one method to reference a local variable of the other B. Declare a variable

More information

Groovy = Java Technology + Ruby + Python for the JVM

Groovy = Java Technology + Ruby + Python for the JVM Groovy = Java Technology + Ruby + Python for the JVM Rod Cope CTO OpenLogic, Inc. http://www.openlogic.com TS-3273 2006 JavaOne SM Conference Session TS-3273 Groovy Goal What You ll Get Out of This Session

More information

comparing groovy & jruby *

comparing groovy & jruby * ThoughtWorks comparing groovy & jruby * * please check all knives, guns, pitchforks, and torches at the door NEAL FORD software architect / meme wrangler ThoughtWorks nford@thoughtworks.com 3003 Summit

More information

Chapter Goals. Chapter One: Introduction. Prerequisites. What Is Programming?

Chapter Goals. Chapter One: Introduction. Prerequisites. What Is Programming? Chapter Goals To understand the activity of programming To learn about the architecture of computers To learn about machine code and high level programming languages To become familiar with your computing

More information

Object Model Comparisons

Object Model Comparisons Object Model Comparisons 1 Languages are designed, just like programs Someone decides what the language is for Someone decides what features it's going to have Can't really understand a language until

More information

Getting Started with Java. Atul Prakash

Getting Started with Java. Atul Prakash Getting Started with Java Atul Prakash Running Programs C++, Fortran, Pascal Python, PHP, Ruby, Perl Java is compiled into device-independent code and then interpreted Source code (.java) is compiled into

More information

CSE 341, Autumn 2015, Ruby Introduction Summary

CSE 341, Autumn 2015, Ruby Introduction Summary CSE 341, Autumn 2015, Ruby Introduction Summary Disclaimer: This lecture summary is not necessarily a complete substitute for atting class, reading the associated code, etc. It is designed to be a useful

More information

Eclipse. JVM, main method and using Eclipse. Dr. Siobhán Drohan. Produced by: Department of Computing and Mathematics

Eclipse. JVM, main method and using Eclipse. Dr. Siobhán Drohan. Produced by: Department of Computing and Mathematics Eclipse JVM, main method and using Eclipse Produced by: Dr. Siobhán Drohan Department of Computing and Mathematics http://www.wit.ie/ Topics list Files in Java. Java Virtual Machine. main method. Eclipse

More information

LECTURE 2 (Gaya College of Engineering)

LECTURE 2 (Gaya College of Engineering) LECTURE 2 (Gaya College of Engineering) 1) CHARACTERISTICS OF OBJECTS: Object is an instance of a class. So, it is an active entity. Objects have three basic characteristics. They are- State: An object

More information

2/9/2012. Chapter One: Introduction. Chapter Goals

2/9/2012. Chapter One: Introduction. Chapter Goals Chapter One: Introduction Chapter Goals To understand the activity of programming To learn about the architecture of computers To learn about machine code and high level programming languages To become

More information

March 26, Groovy Magic How Java Got Its Groove On

March 26, Groovy Magic How Java Got Its Groove On March 26, 2008 Groovy Magic How Java Got Its Groove On By Dan Sline Agenda What is Groovy? Groovy Fundamentals Integrating Groovy and Java Putting it all together About JPMorganChase HJUG Presentation

More information

Rules and syntax for inheritance. The boring stuff

Rules and syntax for inheritance. The boring stuff Rules and syntax for inheritance The boring stuff The compiler adds a call to super() Unless you explicitly call the constructor of the superclass, using super(), the compiler will add such a call for

More information

Scala, Your Next Programming Language

Scala, Your Next Programming Language Scala, Your Next Programming Language (or if it is good enough for Twitter, it is good enough for me) WORLDCOMP 2011 By Dr. Mark C. Lewis Trinity University Disclaimer I am writing a Scala textbook that

More information

Metaprogramming. Concepts of Programming Languages. Alexander Schramm. 2. November Institut für Softwaretechnik und Programmiersprachen

Metaprogramming. Concepts of Programming Languages. Alexander Schramm. 2. November Institut für Softwaretechnik und Programmiersprachen Metaprogramming Concepts of Programming Languages Alexander Schramm Institut für Softwaretechnik und Programmiersprachen 2. November 2015 A. Schramm 2. November 2015 1/39 Table of Contents Introduction

More information

SpringSource Tool Suite M2

SpringSource Tool Suite M2 SpringSource Tool Suite 2.7.0.M2 - New and Noteworthy - Martin Lippert 2.7.0.M2 June 13, 2011 Updated for 2.7.0.M2 ENHANCEMENTS 2.7.0.M2 General Updates Memory Settings We raised the default memory settings

More information

Overview of the Ruby Language. By Ron Haley

Overview of the Ruby Language. By Ron Haley Overview of the Ruby Language By Ron Haley Outline Ruby About Ruby Installation Basics Ruby Conventions Arrays and Hashes Symbols Control Structures Regular Expressions Class vs. Module Blocks, Procs,

More information

COMP 215: INTRO TO PROGRAM DESIGN. Prof. Chris Jermaine Chris Prof. Chris Dr. Chris

COMP 215: INTRO TO PROGRAM DESIGN. Prof. Chris Jermaine Chris Prof. Chris Dr. Chris COMP 215: INTRO TO PROGRAM DESIGN Prof. Chris Jermaine cmj4@cs.rice.edu Chris Prof. Chris Dr. Chris 1 This Class 50% of content: modern programming and program design The Java programming language will

More information

A PROGRAM IS A SEQUENCE of instructions that a computer can execute to

A PROGRAM IS A SEQUENCE of instructions that a computer can execute to A PROGRAM IS A SEQUENCE of instructions that a computer can execute to perform some task. A simple enough idea, but for the computer to make any use of the instructions, they must be written in a form

More information

ICOM 4015: Advanced Programming

ICOM 4015: Advanced Programming ICOM 4015: Advanced Programming Lecture 1 Reading: Chapter One: Introduction Chapter 1 Introduction Chapter Goals To understand the activity of programming To learn about the architecture of computers

More information

Client Usage. Client Usage. Assumptions. Usage. Hdfs.put( session ).file( localfile ).to( remotefile ).now() java -jar bin/shell.

Client Usage. Client Usage. Assumptions. Usage. Hdfs.put( session ).file( localfile ).to( remotefile ).now() java -jar bin/shell. Client Usage Client Usage Hadoop requires a client that can be used to interact remotely with the services provided by Hadoop cluster. This will also be true when using the Apache Knox Gateway to provide

More information

Six Things Groovy Can Do For You

Six Things Groovy Can Do For You Six Things Groovy Can Do For You By Alan Green, Senior Consultant Cirrus Technologies Pty. Ltd. Abstract Groovy is a scripting language for the Java Virtual Machine, due for a 1.0 release in late 2005.

More information

Grails Framework. Modern Web Applications written in Groovy CERN EUROPEAN ORGANIZATION FOR NUCLEAR RESEARCH. Eloy Reguero Fuentes.

Grails Framework. Modern Web Applications written in Groovy CERN EUROPEAN ORGANIZATION FOR NUCLEAR RESEARCH. Eloy Reguero Fuentes. CERN Grails Framework Modern Web Applications written in Groovy You Who knows what Groovy is? Who knows what Grails is? Who knows JAVA? Summary What is Grails What is Groovy Grails Architecture Grails

More information

Interpreted vs Compiled. Java Compile. Classes, Objects, and Methods. Hello World 10/6/2016. Python Interpreted. Java Compiled

Interpreted vs Compiled. Java Compile. Classes, Objects, and Methods. Hello World 10/6/2016. Python Interpreted. Java Compiled Interpreted vs Compiled Python 1 Java Interpreted Easy to run and test Quicker prototyping Program runs slower Compiled Execution time faster Virtual Machine compiled code portable Java Compile > javac

More information

CS 349 / SE 382 Scripting. Professor Michael Terry March 18, 2009

CS 349 / SE 382 Scripting. Professor Michael Terry March 18, 2009 CS 349 / SE 382 Scripting Professor Michael Terry March 18, 2009 Today s Agenda Scripting Jython CS 349 / SE 382 / 2 Announcements Assignment 4 due next Friday! CS 349 / SE 382 / 3 Questions? CS 349 /

More information

Lecture 2. COMP1406/1006 (the Java course) Fall M. Jason Hinek Carleton University

Lecture 2. COMP1406/1006 (the Java course) Fall M. Jason Hinek Carleton University Lecture 2 COMP1406/1006 (the Java course) Fall 2013 M. Jason Hinek Carleton University today s agenda a quick look back (last Thursday) assignment 0 is posted and is due this Friday at 2pm Java compiling

More information

What readers are saying about Programming Groovy

What readers are saying about Programming Groovy What readers are saying about Programming Groovy More than a tutorial on the Groovy language, Programming Groovy is an excellent resource for learning the advanced concepts of metaobject programming, unit

More information

Groovy Scripting for Java

Groovy Scripting for Java Groovy Scripting for Java Ian Darwin, http://www.darwinsys.com/ Java Cookbook site: http://javacook.darwinsys.com/ 1 Notices This presentation is published under a Creative Commons License See http://creativecommons.org/licenses/by-nc-sa/2.0/

More information

Lecture 02, Fall 2018 Friday September 7

Lecture 02, Fall 2018 Friday September 7 Anatomy of a class Oliver W. Layton CS231: Data Structures and Algorithms Lecture 02, Fall 2018 Friday September 7 Follow-up Python is also cross-platform. What s the advantage of Java? It s true: Python

More information

They are a block of code plus the bindings to the environment they came from (Ragusa Idiom / function object).

They are a block of code plus the bindings to the environment they came from (Ragusa Idiom / function object). maxbox Starter 31 Start with Closures 1.1 A Function Block in a Box Today we step through a topic of closures. One of the questions that comes up when learning closures is how they can be useful when they're

More information

CS 112 Introduction to Computing II. Wayne Snyder Computer Science Department Boston University

CS 112 Introduction to Computing II. Wayne Snyder Computer Science Department Boston University CS 112 Introduction to Computing II Wayne Snyder Department Boston University Today: Java basics: Compilation vs Interpretation Program structure Statements Values Variables Types Operators and Expressions

More information

Tutorial 1 CSC 201. Java Programming Concepts عؾادئماظربجمةمبادؿكدامماجلاصا

Tutorial 1 CSC 201. Java Programming Concepts عؾادئماظربجمةمبادؿكدامماجلاصا Tutorial 1 CSC 201 Java Programming Concepts عؾادئماظربجمةمبادؿكدامماجلاصا م- م- م- م- م- Chapter 1 1. What is Java? 2. Why Learn Java? a. Java Is Platform Independent b. Java is Easy to learn 3. Programming

More information

Introduction to Computers and Java

Introduction to Computers and Java Introduction to Computers and Java Chapter 1 Objectives Overview of computer hardware and software, programs and compilers the Java programming language Example program Hardware and Software Computer systems

More information

Chapter 8 Objects and Classes Dr. Essam Halim Date: Page 1

Chapter 8 Objects and Classes Dr. Essam Halim Date: Page 1 Assignment (1) Chapter 8 Objects and Classes Dr. Essam Halim Date: 18-3-2014 Page 1 Section 8.2 Defining Classes for Objects 1 represents an entity in the real world that can be distinctly identified.

More information

Life Without NetBeans

Life Without NetBeans Life Without NetBeans Part A Writing, Compiling, and Running Java Programs Almost every computer and device has a Java Runtime Environment (JRE) installed by default. This is the software that creates

More information

1.00 Tutorial 3. Methods, Classes Arrays & ArrayLists. September 26 & 27, 2005

1.00 Tutorial 3. Methods, Classes Arrays & ArrayLists. September 26 & 27, 2005 1.00 Tutorial 3 Methods, Classes Arrays & ArrayLists September 26 & 27, 2005 1 Topics Java Compliance Methods Pass by Value Access Static methods Classes & Objects Arrays & ArrayLists Problem Set 3 discussion

More information

SLIM and the future of FitNesse. Gojko Adzic

SLIM and the future of FitNesse. Gojko Adzic SLIM and the future of FitNesse Gojko Adzic http://gojko.net gojko@gojko.com http://twitter.com/gojkoadzic Is FIT dead? FIT/FitNesse were The acceptance testing toolkit Java FIT has not been developed

More information

CS 231 Data Structures and Algorithms, Fall 2016

CS 231 Data Structures and Algorithms, Fall 2016 CS 231 Data Structures and Algorithms, Fall 2016 Dr. Bruce A. Maxwell Department of Computer Science Colby College Course Description Focuses on the common structures used to store data and the standard

More information

Scala : an LLVM-targeted Scala compiler

Scala : an LLVM-targeted Scala compiler Scala : an LLVM-targeted Scala compiler Da Liu, UNI: dl2997 Contents 1 Background 1 2 Introduction 1 3 Project Design 1 4 Language Prototype Features 2 4.1 Language Features........................................

More information

Simplify Enterprise Development With Scripting

Simplify Enterprise Development With Scripting Simplify Enterprise Development With Scripting Guillaume Laforge Software Architect OCTO Technology http://www.octo.com Tim Gleason/Tugdual Grall OracleAS Development Oracle Corporation http://www.oracle.com

More information

Simple Java Programs. OOC 4 th Sem, B Div Prof. Mouna M. Naravani

Simple Java Programs. OOC 4 th Sem, B Div Prof. Mouna M. Naravani Simple Java Programs OOC 4 th Sem, B Div 2016-17 Prof. Mouna M. Naravani /* */ A First Simple Program This is a simple Java program. Call this file "Example.java". class Example { } // Your program begins

More information

The Script Bowl Featuring Groovy, JRuby, Jython and Scala. Raghavan Rags N. Srinivas CTO, Technology Evangelism

The Script Bowl Featuring Groovy, JRuby, Jython and Scala. Raghavan Rags N. Srinivas CTO, Technology Evangelism The Script Bowl Featuring Groovy, JRuby, Jython and Scala Raghavan Rags N. Srinivas CTO, Technology Evangelism The Script Bowl: Groovy Style Guillaume Laforge VP Technology at G2One, Inc. Groovy Project

More information

This tutorial explains how you can use Gradle as a build automation tool for Java as well as Groovy projects.

This tutorial explains how you can use Gradle as a build automation tool for Java as well as Groovy projects. About the Tutorial Gradle is an open source, advanced general purpose build management system. It is built on ANT, Maven, and lvy repositories. It supports Groovy based Domain Specific Language (DSL) over

More information

How to make a "hello world" program in Java with Eclipse *

How to make a hello world program in Java with Eclipse * OpenStax-CNX module: m43473 1 How to make a "hello world" program in Java with Eclipse * Hannes Hirzel Based on How to make a "hello world" program in Java. by Rodrigo Rodriguez This work is produced by

More information

Produced by. Design Patterns. MSc in Computer Science. Eamonn de Leastar

Produced by. Design Patterns. MSc in Computer Science. Eamonn de Leastar Design Patterns MSc in Computer Science Produced by Eamonn de Leastar (edeleastar@wit.ie) Department of Computing, Maths & Physics Waterford Institute of Technology http://www.wit.ie http://elearning.wit.ie

More information

SpringSource Tool Suites M3

SpringSource Tool Suites M3 SpringSource Tool Suites 3.0.0.M3 - New and Noteworthy - Martin Lippert 3.0.0.M3 July 9, 2012 Updated for 3.0.0.M3 ENHANCEMENTS 3.0.0.M3 General Updates Distribution based on Eclipse Juno (4.2.0) STS now

More information

SDKs - Eclipse. SENG 403, Tutorial 2

SDKs - Eclipse. SENG 403, Tutorial 2 SDKs - SENG 403, Tutorial 2 AGENDA - SDK Basics - - How to create Project - How to create a Class - Run Program - Debug Program SDK Basics Software Development Kit is a set of software development tools

More information

Andy Clement, SpringSource/VMware SpringSource, A division of VMware. All rights reserved

Andy Clement, SpringSource/VMware SpringSource, A division of VMware. All rights reserved Mixed language project compilation in Eclipse: Java and Groovy Andy Clement, SpringSource/VMware 2010 SpringSource, A division of VMware. All rights reserved Agenda Me Groovy-Eclipse version 2 Quick review

More information

Binghamton University. CS-140 Fall Problem Solving. Creating a class from scratch

Binghamton University. CS-140 Fall Problem Solving. Creating a class from scratch Problem Solving Creating a class from scratch 1 Recipe for Writing a Class 1. Write the class boilerplate stuff 2. Declare Fields 3. Write Creator(s) 4. Write accessor methods 5. Write mutator methods

More information

SpringSource Tool Suites 3.0.0

SpringSource Tool Suites 3.0.0 SpringSource Tool Suites 3.0.0 - New and Noteworthy - Martin Lippert 3.0.0 August 13, 2012 Updated for 3.0.0.RELEASE ENHANCEMENTS 3.0.0 General Updates Spring Tool Suite & Groovy/Grails Tool Suite Starting

More information

Your First Ruby Script

Your First Ruby Script Learn Ruby in 50 pages Your First Ruby Script Step-By-Step Martin Miliauskas @mmiliauskas 1 Your First Ruby Script, Step-By-Step By Martin Miliauskas Published in 2013 by Martin Miliauskas On the web:

More information

CSE 341: Programming Languages

CSE 341: Programming Languages CSE 341: Programming Languages Hal Perkins Spring 2011 Lecture 19 Introduction to Ruby Hal Perkins CSE341 Spring 2011, Lecture 19 1 Today Why Ruby? Some basics of Ruby programs Syntax Classes, Methods

More information

Date & Time Handling In JAVA

Date & Time Handling In JAVA Date & Time Handling In JAVA Sisoft Technologies Pvt Ltd SRC E7, Shipra Riviera Bazar, Gyan Khand-3, Indirapuram, Ghaziabad Website: www.sisoft.in Email:info@sisoft.in Phone: +91-9999-283-283 1 Date and

More information

Every language has its own scoping rules. For example, what is the scope of variable j in this Java program?

Every language has its own scoping rules. For example, what is the scope of variable j in this Java program? Lexical Binding There are two ways a variable can be used in a program: As a declaration As a "reference" or use of the variable Scheme has two kinds of variable "declarations" -- the bindings of a let-expression

More information

Java Bytecode (binary file)

Java Bytecode (binary file) Java is Compiled Unlike Python, which is an interpreted langauge, Java code is compiled. In Java, a compiler reads in a Java source file (the code that we write), and it translates that code into bytecode.

More information

Character Stream : It provides a convenient means for handling input and output of characters.

Character Stream : It provides a convenient means for handling input and output of characters. Be Perfect, Do Perfect, Live Perfect 1 1. What is the meaning of public static void main(string args[])? public keyword is an access modifier which represents visibility, it means it is visible to all.

More information

A- Core Java Audience Prerequisites Approach Objectives 1. Introduction

A- Core Java Audience Prerequisites Approach Objectives 1. Introduction OGIES 6/7 A- Core Java The Core Java segment deals with the basics of Java. It is designed keeping in mind the basics of Java Programming Language that will help new students to understand the Java language,

More information

CS Introduction to Computational and Data Science. Instructor: Renzhi Cao Computer Science Department Pacific Lutheran University Spring 2017

CS Introduction to Computational and Data Science. Instructor: Renzhi Cao Computer Science Department Pacific Lutheran University Spring 2017 CS 133 - Introduction to Computational and Data Science Instructor: Renzhi Cao Computer Science Department Pacific Lutheran University Spring 2017 Previous class We have learned the path and file system.

More information

Chapter 4 Java Language Fundamentals

Chapter 4 Java Language Fundamentals Chapter 4 Java Language Fundamentals Develop code that declares classes, interfaces, and enums, and includes the appropriate use of package and import statements Explain the effect of modifiers Given an

More information

Selected Questions from by Nageshwara Rao

Selected Questions from  by Nageshwara Rao Selected Questions from http://way2java.com by Nageshwara Rao Swaminathan J Amrita University swaminathanj@am.amrita.edu November 24, 2016 Swaminathan J (Amrita University) way2java.com (Nageshwara Rao)

More information

CmSc 150 Fundamentals of Computing I. Lesson 28: Introduction to Classes and Objects in Java. 1. Classes and Objects

CmSc 150 Fundamentals of Computing I. Lesson 28: Introduction to Classes and Objects in Java. 1. Classes and Objects CmSc 150 Fundamentals of Computing I Lesson 28: Introduction to Classes and Objects in Java 1. Classes and Objects True object-oriented programming is based on defining classes that represent objects with

More information

CS111: PROGRAMMING LANGUAGE II

CS111: PROGRAMMING LANGUAGE II CS111: PROGRAMMING LANGUAGE II Computer Science Department Lecture 1(c): Java Basics (II) Lecture Contents Java basics (part II) Conditions Loops Methods Conditions & Branching Conditional Statements A

More information

Lecture 1. basic Python programs, defining functions

Lecture 1. basic Python programs, defining functions Lecture 1 basic Python programs, defining functions Lecture notes modified from CS Washington CS 142 Except where otherwise noted, this work is licensed under: http://creativecommons.org/licenses/by-nc-sa/3.0

More information

Dynalink. Dynamic Linker Framework for Languages on the JVM. Attila Szegedi, Software Engineer, Twitter

Dynalink. Dynamic Linker Framework for Languages on the JVM. Attila Szegedi, Software Engineer, Twitter Dynalink Dynamic Linker Framework for Languages on the JVM Attila Szegedi, Software Engineer, Twitter Inc. @asz 1 What s the problem? circle.color = 0xae17e3 class Circle def color=(value)... end end public

More information

Topic 6: Inner Classes

Topic 6: Inner Classes Topic 6: Inner Classes What's an inner class? A class defined inside another class Three kinds: inner classes static nested classes anonymous classes this lecture: Java mechanisms later: motivation & typical

More information

(A) 99 (B) 100 (C) 101 (D) 100 initial integers plus any additional integers required during program execution

(A) 99 (B) 100 (C) 101 (D) 100 initial integers plus any additional integers required during program execution Ch 5 Arrays Multiple Choice 01. An array is a (A) (B) (C) (D) data structure with one, or more, elements of the same type. data structure with LIFO access. data structure, which allows transfer between

More information

Class, Variable, Constructor, Object, Method Questions

Class, Variable, Constructor, Object, Method Questions Class, Variable, Constructor, Object, Method Questions http://www.wideskills.com/java-interview-questions/java-classes-andobjects-interview-questions https://www.careerride.com/java-objects-classes-methods.aspx

More information

TypeScript. Types. CS144: Web Applications

TypeScript. Types. CS144: Web Applications TypeScript Superset of JavaScript (a.k.a. JavaScript++) to make it easier to program for largescale JavaScript projects New features: types, interfaces, decorators,... All additional TypeScript features

More information

Programming Language Concepts: Lecture 2

Programming Language Concepts: Lecture 2 Programming Language Concepts: Lecture 2 Madhavan Mukund Chennai Mathematical Institute madhavan@cmi.ac.in http://www.cmi.ac.in/~madhavan/courses/pl2011 PLC 2011, Lecture 2, 6 January 2011 Classes and

More information

Why add Groovy to Java?

Why add Groovy to Java? Why add Groovy to Java? This chapter covers Issues with Java Groovy features that help Java Common use cases for Java and how Groovy makes them simpler For all of its flaws (and we ll be reviewing them

More information

Assumptions. History

Assumptions. History Assumptions A Brief Introduction to Java for C++ Programmers: Part 1 ENGI 5895: Software Design Faculty of Engineering & Applied Science Memorial University of Newfoundland You already know C++ You understand

More information

Lecture Set 2: Starting Java

Lecture Set 2: Starting Java Lecture Set 2: Starting Java 1. Java Concepts 2. Java Programming Basics 3. User output 4. Variables and types 5. Expressions 6. User input 7. Uninitialized Variables 0 This Course: Intro to Procedural

More information

S AMPLE CHAPTER. Kenneth A. Kousen. FOREWORD BY Guillaume Laforge MANNING

S AMPLE CHAPTER. Kenneth A. Kousen. FOREWORD BY Guillaume Laforge MANNING S AMPLE CHAPTER Kenneth A. Kousen FOREWORD BY Guillaume Laforge MANNING Making Java Groovy by Kenneth A. Kousen Chapter 1 Copyright 2014 Manning Publications brief contents PART 1 UP TO SPEED WITH GROOVY...1

More information

Chapter 2: Programming Concepts

Chapter 2: Programming Concepts Chapter 2: Programming Concepts Objectives Students should Know the steps required to create programs using a programming language and related terminology. Be familiar with the basic structure of a Java

More information

Computer Programming

Computer Programming Computer Programming Dr. Deepak B Phatak Dr. Supratik Chakraborty Department of Computer Science and Engineering Session: An Example with Sequential and Conditional Execution Dr. Deepak B. Phatak & Dr.

More information

Lecture Set 2: Starting Java

Lecture Set 2: Starting Java Lecture Set 2: Starting Java 1. Java Concepts 2. Java Programming Basics 3. User output 4. Variables and types 5. Expressions 6. User input 7. Uninitialized Variables 0 This Course: Intro to Procedural

More information

Building Java Programs

Building Java Programs Building Java Programs Chapter 2 Lecture 2-1: Expressions and Variables reading: 2.1-2.2 1 Data and expressions reading: 2.1 self-check: 1-4 videos: Ch. 2 #1 2 Data types type: A category or set of data

More information

COSC 123 Computer Creativity. Introduction to Java. Dr. Ramon Lawrence University of British Columbia Okanagan

COSC 123 Computer Creativity. Introduction to Java. Dr. Ramon Lawrence University of British Columbia Okanagan COSC 123 Computer Creativity Introduction to Java Dr. Ramon Lawrence University of British Columbia Okanagan ramon.lawrence@ubc.ca Key Points 1) Introduce Java, a general-purpose programming language,

More information

Project 1. Java Control Structures 1/17/2014. Project 1 and Java Intro. Project 1 (2) To familiarize with

Project 1. Java Control Structures 1/17/2014. Project 1 and Java Intro. Project 1 (2) To familiarize with Project 1 and Java Intro Sharma Chakravarthy Information Technology Laboratory (IT Lab) Computer Science and Engineering Department The University of Texas at Arlington, Arlington, TX 76019 Email: sharma@cse.uta.edu

More information

Midterm I - CSE11 Fall 2013 CLOSED BOOK, CLOSED NOTES 50 minutes, 100 points Total.

Midterm I - CSE11 Fall 2013 CLOSED BOOK, CLOSED NOTES 50 minutes, 100 points Total. Midterm I - CSE11 Fall 2013 CLOSED BOOK, CLOSED NOTES 50 minutes, 100 points Total. Name: ID: Problem 1) (8 points) For the following code segment, what are the values of i, j, k, and d, after the segment

More information