Kelby Zorgdrager from DevelopIntelligence explains the differences between the variations of Java and what's new in Java 7.
If you need help with Java training DevelopIntelligence and provide on-site training within two weeks. Customized and affordable for any organization.
08448380779 Call Girls In Friends Colony Women Seeking Men
Whats New in Java 5, 6, & 7 (Webinar Presentation - June 2013)
1. What’s New in Java 5, 6 & 7
Delivered by DevelopIntelligence
2. About DevelopIntelligence
Provide highly-customized, role-based, project-
centric learning solutions to software teams
Specialize in areas of Java, Open Source, Web
Development, and Mobile
Delivered training to over 40,000 engineers
worldwide
Headquartered in Boulder CO
3. About Kelby Zorgdrager
President of DevelopIntelligence
Working with and teaching
Java since 1996 (1.0.1)
Former Sun Microsystems Java Platform
engineer
Delivered training to over 5,000 engineers
worldwide
Copyright DevelopIntelligence LLC
4. Webinar Topics
In this presentation, we will cover:
Current State of Java
Newish Language Features
Questions at the end
DevelopIntelligence http://www.DevelopIntelligence.com 4
5. Objectives
When we are done, you should be:
Familiar with current state of Java
Aware of new features
DevelopIntelligence http://www.DevelopIntelligence.com 5
7. Java SE 5.0
Significant revamp of Java
Not largest revamp in terms of new APIs
Significance lies in new language features
Released Sept 2004 - Code named “Tiger”
EOL’d Oct 30, 2009
Current version 1.5 update 22
DevelopIntelligence http://www.DevelopIntelligence.com 7
8. Java SE 6
Focused on refreshing APIs, internals, and
Scripting support
Released Dec 2006 - Code named “Mustag”
Current version 1.6 update 43
DevelopIntelligence http://www.DevelopIntelligence.com 8
9. Java SE 7
Focused on simplifying
language, APIs, internals, and dynamic
language support
Released July 2011 - Code named “Dolphin”
Current version 1.7 update 21
DevelopIntelligence http://www.DevelopIntelligence.com 9
17. Simplification of Strings [1.7]
Strings are constants - And - treated like
primitives (at least from a coding perspective)
But until Java 7 – weren’t supported in switch
statements
Copyright DevelopIntelligence LLC
String a = “Hello”;
. . .
switch(a) {
case “hello”:
case “Hello”:
case “HELLO”
//do something
break;
default:
//do something else
break;
}
20. Autoboxing Support
Primitive Type Reference Type
boolean java.lang.Boolean
byte java.lang.Byte
short java.lang.Short
int java.lang.Integer
long java.lang.Long
float java.lang.Float
double java.lang.Double
char java.lang.Character
20DevelopIntelligence http://www.DevelopIntelligence.com
26. Working with an Enum
Enums are types – provide type safety for a
closed set of values
Values are instances of an enum type
Stored as static final fields in type
Defined in terms of
name - stringified representation of field name
ordinal - position in set
Referencable through dot-notation
Are switchable
26DevelopIntelligence http://www.DevelopIntelligence.com
28. Working with an Enum [cont.]
Reference using dot notation
Enums have some predefined static methods
values – retrieves all enum instances
valueOf - transforms String value into enum instance
Have some predefined instance methods
name – upper-case name of enum instance
toString
equals
hashCode
28DevelopIntelligence http://www.DevelopIntelligence.com
29. Accessing an Enum Value
29DevelopIntelligence http://www.DevelopIntelligence.com
33. Typesafe Collection Advantages
Adds compile time type safety to collections
Type safety simplifies collection interactions (ie:
iterating)
No advantages (or disadvantages) in speed or
performance
33DevelopIntelligence http://www.DevelopIntelligence.com
34. Simple List Example [Old way]
34DevelopIntelligence http://www.DevelopIntelligence.com
35. Simple List Example [1.5]
35DevelopIntelligence http://www.DevelopIntelligence.com
36. Simplification of Generics [1.7]
1.5 way of declaring and initializing a collection:
List<String> list = new ArrayList<String>();
Compiler should be “smart enough” to infer type
from declaration
1.7 way of declaring and initializing:
List<String> list = new ArrayList<>();
Copyright DevelopIntelligence LLC
38. Annotations
Metadata facility for Java
Allowing you to provide additional data alongside Java
classes
Similar to Javadoc “metadata” facility
Expanded and formalized mechanism
“Competes” with Doclet / XDoclet
Recognized by Java compiler and other tools
DevelopIntelligence http://www.DevelopIntelligence.com 38
41. Covariant Returns
What are they?
Allows return type of inherited method to be narrowed
Applies to method over-riding not over-loading
Why do they exist?
Needed to support generics mechanism
Removes narrowing cast on polymorphic returns
Prevents run-time ClassCastExceptions on returns
Provides compile-time type dependency checking
41DevelopIntelligence http://www.DevelopIntelligence.com
44. Simplification of try/catch [1.7]
There’s a lot of try/catch/finally boiler-plate code
out there
Why not let the compiler generate it for you?
Copyright DevelopIntelligence LLC
FileInputStream fis;
try {
fis = new FileInputStream(“/tmp/myfile.txt”);
…
} catch(IOException ioe) {
…
} finally {
fis.close()
}
try (InputStream fis =new FileInputStream(“/tmp/myfile.txt”)) {
…
}
New way
46. How DevelopIntelligence Can Help?
FAST: We can provide customized on-site training within
two weeks to help with tight deadlines.
CUSTOMIZED: Complete customization of the training
you need at no additional costs to your organization.
AFFORDABLE: We have the most flexible pricing
module in the industry and can work with any budget.
CONTACT US: 877-629-5631
dave@developintelligence.com
kelby@developintelligence.com
DevelopIntelligence http://www.DevelopIntelligence.com 46
47. Win a Free Safari Account
Question:
“What date did the FCS of JDK 1.0 occur”
Post your answer to:
LinkedIn:
http://www.linkedin.com/company/developintelligence
Twitter: http://twitter.com/DevIntelligence
All correct answers will be entered into a raffle –
winners will be announced Monday June 17
Copyright DevelopIntelligence LLC
Notas do Editor
What’s New In Java 5, 6 & 7Delivered by DevelopIntelligence
About DevelopIntelligenceProvide highly-customized, role-based, project-centric learning solutions to software teamsSpecialize in areas of Java, Open Source, Web Development, and MobileDelivered training to over 40,000 engineers worldwideHeadquartered in Boulder CO