November 24, 2013

Published November 24, 2013 by

Java Data Types

Data Types: A data type or simply type is a classification identifying one of various types of data, such as whole numbers or fractional numbers.

Data Type determines:
  • the possible values for that type
  • the operations that can be done on values of that type
  • the meaning of the data
  • the way values of that type can be stored
Java is a strongly typed language because when you declare a variable, you must specify the variable’s type. Then the compiler ensures that the wrong type data is not assigned to the variable.

Java data types are mainly of two types:
  • Primitive Types
  • Reference Types
Primitive Types:
  • Primitive types are defined by the language itself. 
  • The memory location of primitive type variable contains the actual value of the variable
Reference Types:
  • Reference types are defined by classes in Java API or by classes created by the developers rather than by the language itself.
  • The memory location of reference type variable contains an address that indicates the memory location of the actual object.

Primitive Types vs. Reference Type:
Primitive Types
Reference Types
1. Primitive types are the fundamental, built in (as keyword) types
1. Reference types are constructed from primitive types either through class definition, interface definition or the use of arrays.
2. A variable of any primitive type contains a single value of the appropriate size and format.
2. A variable of a reference type holds a null reference or a reference to an instance of a class
3. Values of these types cannot be decomposed
3. A reference type can be decomposed into several values.

List of Primitive Types:
Types
Characteristics
Memory Size (byte)
Minimum Value
Maximum Value
byte
Whole numbers
1
 -128
127 
short
2
-32768
32767
int
4
-2147483648
2147483647
long
8
-9223372036854775808
9223372036854775807
float
Fractional numbers
4
1.4E-45
3.4028235E38
double
8
4.9E-324
1.7976931348623157E308
char
Any single symbol
2
'\u0000', that is 0
'\uffff' that is 65535
boolean
true/false
1



Reference Types Example:
Java classes, interfaces and arrays are reference types.
  • String
  • Date
  • And many more …
Further reading:

Read More

December 16, 2010

Published December 16, 2010 by

Google Web Toolkit 2 Application Development Cookbook


Over 70 simple but incredibly effective practical recipes to develop web applications using GWT with JPA , MySQL and iReport


Overview of Google Web Toolkit 2 Application Development Cookbook

  • Create impressive, complex browser-based web applications with GWT 2
  • Learn the most effective ways to create reports with parameters, variables, and subreports using iReport
  • Create Swing-like web-based GUIs using the Ext GWT class library
  • Develop applications using browser quirks, Javascript,HTML scriplets from scratch
  • Part of Packt's Cookbook series: Each recipe is a carefully organized sequence of instructions to complete the task as efficiently as possible

GWT 2 radically improves web experience for users by using existing Java tools to build no-compromise AJAX for any modern browser. It provides a solid platform so that other great libraries can be built on top of GWT. Creating web applications efficiently and making them impressive, however, is not as easy as it sounds. Writing web applications for multiple browsers can be quite tasking. In addition, building, reusing, and maintaining large JavaScript code bases and AJAX components can be difficult.

GWT 2 Application Development Cookbook eases these burdens by allowing developers to quickly build and maintain complex yet highly efficient JavaScript front-end applications in the Java programming language . It tells you how to make web experience all the more thrilling and hassle free, using various tools along with GWT SDK.

This book starts with developing an application from scratch. Right from creating the layout of the home page to home page elements including left and right sidebars, to placing tree like navigational menu, menu bars, tool bars, banners, footers are discussed with examples.

You will see how to create forms using the Ext GWT library widgets and handle different types of events. Then you will move on to see how to design a database for sales processing systems and learn to create the database in MySQL with the help of easy–to-follow recipes.

One of the interesting topics of this book is using JPA in GWT. Using the JPA object in GWT is a challenge. To use them perfectly, a mechanism to convert the JPA object into plain object and vice versa is required. You will see recipes to use entity classes, entity managers, and controller classes in GWT application. You will efficiently create reports with parameters, variables and subreports, and get the report output in both HTML and PDF format using real-world recipes.

You will then learn to configure the GlassFish server to deploy a GWT application with database. Finally, learn how to trace speed and improve perfomance in web applications using tracing techniques.

Create impressive web applications with tool bars, menus, multiple windows, and more with this step-by-step guide.

What you will learn from this book :

  • Set up and configure GWT SDK, GlassFish server, MySQL server, NetBeans, GWT4NB, Ext GWT , iReport plugins for developing the business application in GWT
  • Design a database for sales processing system in MySQL, back up and restore the database
  • Identify business entities and the relationships and constraints among them
  • Handle events such clicking on buttons, typing in text fields, selecting items in a combo box, selecting radios, selecting menus, and selecting toolbar icons
  • Manage entities using entity framework through Java Persistence API (JPA)
  • Use iReport for any GWT application to get the output of the reports in both HTML and PDF format
  • Create Graphical User Interface (GUI) for accepting user input and display information to the user using Ext GWT
  • Control communication between the server and client using GWTRPC mechanism
  • Create a WAR file for GWT application and deploy it in Glassfish server

Approach
The recipes in this book are in a straightforward and easy to follow format.The range of topics covered in this book will bring out the forward-thinking Java developer in you.

Who this book is written for
If you want to build AJAX web applications with GWT then this book is for you.
Developers with prior programming experience of Java development and object-oriented programming will find this book very useful.

Read More

September 22, 2010

Published September 22, 2010 by

Creating GWT Project in Eclipse

Getting Ready:

Before following this quick tutorial ensure that you have done the followings:
1.       Install the JDK. You can download it from http://www.oracle.com/technetwork/java/javase/downloads/index.html
2.       Install the Eclipse IDE. It can be downloaded from http://www.eclipse.org/downloads/
3.       Install the GWT SDK which is available for download at http://code.google.com/webtoolkit/download.html
4.       Install the Google Plugin for Eclipse as instructed at http://code.google.com/eclipse/docs/download.html


How to do it:

Now follow the steps below to create the GWT Project
1.       Start Eclipse IDE
2.       Go to File | New | Other…
3.       Select Web Application Project under Google


4.       Press Next
5.       Give Project Name HelloGWT; give a Package Name (in this example it is com.blogspot.gwtguide.eclipse.hello); select Use Google Web Toolkit



6.       If the GWT SDK is not configured, click on Configure SDKs… ; add the web toolkit and press OK to close the dialog


7.       Press Finish and the project is created.




Run the project and see output



Read More