all programming language at TCCI, coaching class in Ahmedabad, coaching for programming in Ahmedabad, Java, Java Course In Satellite - Bopal Ahmedabad, Java Language in Bopal and Satellite, learn online Java at TCCI, Uncategorized

DATA TYPES IN JAVA PROGRAMMING – tccicomputercoaching.com

In this article we will learn about the java data types.

Variable is a memory location where we can store the data. There are three types of variables: local, instance and static. There are two types of data types in java, primitive and non-primitive.

Data Types in Java

In general every programming language is containing three categories of data types. They are

  • Fundamental or primitive data types
  • Derived data types
  • User defined data types.

datatype-in-java

Primitive data types

Primitive data types are those whose variables allows us to store only one value but they never allows us to store multiple values of same type. This is a data type whose variable can hold maximum one value at a time.

Data Type Default Value Default size
boolean false 1 bit
char ‘\u0000’ 2 byte
byte 0 1 byte
short 0 2 byte
int 0 4 byte
long 0L 8 byte
float 0.0f 4 byte
double 0.0d 8 byte

 

The Java programming language is statically-typed, which means that all variables must first be declared before they can be used. This involves stating the variable’s type and name, as you’ve already seen:

int gear = 1;

int a;  // valid

a=10;  // valid

User defined data types

User defined data types are those which are developed by programmers by making use of appropriate features of the language.

In java both derived and user defined data type combined name as reference data type.

Student  s = new  Student();

Integer Data Type:

Data Type Size Range
1 Byte 1 + 127 to -128
2 Short 2 + 32767 to -32768
3 Int 4 + x to – (x+1)
4 Long 8 + y to – (y+1)

 

Char Data Type

 
Data Type Size(Byte) Range  
Char 2 232767 to -32768  

Float Data Type

Data Type Size Range Number of decimal places
Float 4 +2147483647 to -2147483648 8
Double 8 + 9.223*1018 16

Boolean Data Type

Boolean data type takes zero bytes of main memory space because Boolean data type of java implemented by Sun Micro System with a concept of flip – flop. A flip – flop is a general purpose register which stores one bit of information (one true and zero false).

Default Values

It’s not always necessary to assign a value when a field is declared. Fields that are declared but not initialized will be set to a reasonable default by the compiler. Generally speaking, this default will be zero or null, depending on the data type. Relying on such default values, however, is generally considered bad programming style.

User Defined Data Type:

Typedef

A typedef associates a name with another data type. Here is the syntax of an IDL typedef:

typedef type identifier;

The type can be any basic IDL data type, a user-defined data structure

typedef int unit;

If you like this post then please share and like this post.

Visit us @ tccicomputercoaching.com

Call us @ 98256 18292.

Mail to tccicoaching@gmail.com

 

all programming language at TCCI, Basic computer course, Compiler Design at TCCI, Java Course In Satellite - Bopal Ahmedabad, learn java online at TCCI, learn online Java at TCCI, Online Coaching at TCCI Computer Coaching, School Computer Course Coaching, vacation course at TCCI

Learn Java FX Layouts at TCCI – tccicomputercoaching.com

Layout panes are containers which are used for flexible and dynamic arrangements of UI controls within a scene graph of a JavaFX application. As a window is resized, the layout pane automatically repositions and resizes the nodes it contains.

javafx.scene.layout Package provides various classes that represents the layouts.

Javafx-Layouts-tcci

The classes are described in the table below.

Class Description
BorderPane Organizes nodes in top, left, right, centre and the bottom of the screen.
FlowPane Organizes the nodes in the horizontal rows according to the available horizontal spaces. Wraps the nodes to the next line if the horizontal space is less than the total width of the nodes
GridPane Organizes the nodes in the form of rows and columns.
HBox Organizes the nodes in a single row.
Pane It is the base class for all the layout classes.
StackPane Organizes nodes in the form of a stack i.e. one onto another
VBox Organizes nodes in a vertical column.

Steps to create layout

In order to create the layouts, we need to follow the following steps.

  1. Instantiate the respective layout class, for example, HBox root = new HBox();
  2. Setting the properties for the layout, for example, root.setSpacing(20);
  3. Adding nodes to the layout object, for example, root.getChildren().addAll(<NodeObjects>);

To learn JavaFX at TCCI.

Call us @ 982561892

Visit us @ http://www.tccicomputercoaching.com

 

Java, learn online Java at TCCI, learn programming online, online C class, online c++ coaching, Online computer course

What is JavaFx API – tccicomputercoaching.com

· JavaFX public API is the top layer of JavaFX architecture which provides all the necessary classes that are responsible for executing a full featured JavaFX application.

Javafx-api-tcci

· The list of all the packages of this API are as follows.

  • javafx.animation − Containsclasses to add transition based animations such as fill,fade, rotate, scale and translation, to the JavaFX nodes.
  • javafx.application− Contains a set of classes responsible for the JavaFX application life cycle.
  • javafx.css − Contains classes to add CSS–like styling to JavaFX GUI applications.
  • javafx.event − Contains classes and interfaces to deliver and handle JavaFX events.
  • javafx.geometry − Contains classes to define 2D objects and perform operations on them.
  • javafx.stage − This package holds the top level container classes for JavaFX
    application.
  • javafx.scene − This package provides classes and interfaces to support the scene
    graph. In addition, it also provides sub-packages such as canvas,chart, control, effect, image, input, layout, media, paint, shape, text, transform, web, etc. There are several components that support this rich API of JavaFX.

1

To learn more in detail about JavaFX at TCCI

Call us @ 9825618292

Visit us @ http://www.tccicomputercoaching.com