However, the release version and apply some improvements and / or corrections. For example: JDK1.1
JavaBeans technology incorporated . Basically this technology describes a bean
as an object their attributes
and access methods (accesors methods):
setters and getters
, and turned all the graphical components in beans.
In JDK1.1 the graphical components (buttons, combos, text areas, etc) convirieron in JavaBeans and added access methods for their attributes. For example, for attribute
size graphic components were added
methods getSize and setSize
to assign a new size to the component. The old method of doing this is called
resize and became obsolete or deprecated
. This implies that if we try compile a program to apply the method
on a component resize the compiler will display a warning
indicating that this method became obsolete and inviting us to consult the documentation to determine the causes and what is the method by which we have to replace .
The image can see how Eclipse
(the tool that we use) indicates that we are using a deprecated method
.
From JDK1.2 applied nomemclatura a change, we started talking about Java 2
and created two distributions:
J2SE - - "Java 2 Standard Edition J2EE
- -" Java 2 Enterprise Edition "
J2SE is the programming language itself: compiler, basic libraries (including the String class
, Object
,
System, etc.) and development tools such as the debugger, a document, etc. J2EE
are "extensions for the development of business applications." We will see a little later but we can go forward which includes (for example) the Java technology to develop web applications: Servlets
,
JSP, etc.
Comparing Java with C and C + + Some differences Comparing Java with C or C + + we will see that Java is much simpler. For example, in C or C + + strings are arrays of characters with a final '\\ 0' (zero bar). In Java we
String class that can handle strings to "high" as in other languages.
String s1 = "Hello,"
String s2 = "what ...???";
String s3 = s1 + s2;
Regarding the booleans in C and C + + are handled with numerical values integers. Int variable
with value 0 (zero) represents false
and nonzero represents true
. In Java there is a boolean type
.
boolean b1 = true;
/ / assign true to boolean b1 b2 =! B1;
/ / assign the denial of b1 b2 b3 boolean = "this is a string." Length () \u0026lt;= 0;
In b3 are assigning the logical outcome of the proposition:
"this is a string." length () \u0026lt;= 0
"This is a string" is a String literal
, is a String is therefore an object as that has methods. In this case we apply the method
length that returns the length of the string and compare it to zero to assign
true or false
as the result.
Another major difference to Java from C and C + + is releasing memory. In C allocated memory when no longer needed we have to free.
char * s = "This is a string";
free (s);
s = "This is another string":
In Java it is necessary to free the memory that we dereference because there
Garbage Collector (or garbage collector) that is responsible for freeing the memory as unreferenced.
String s = "This is a string";
s = "This is another string";
For C + +, Java there is no multiple inheritance. All classes inherit from the base class Object
(as in Smalltalk). Nor are the destroyers and operator overloading.
Some Similarities primitive data types are identical: short
,
int, long
,
float, double
, char
. Java adds:
byte and boolean
.
statements to code structures Control:
while, do while
,
for , if
and switch are the same.
logical and binary operators are the same too.
Here are some comparisons:
HolaMundo.c 1:
2: # include \u0026lt;stdio.h >
3:
4: int main ( )
5: {
6: / * print in stdout * /
7: printf ( " Hello World C " ) ;
8:}
9:
HolaMundo.java 1:
2: public class HelloWorld
3:
{4: public static void main ( String args [] )
5: {
6: / * prints in stdout * /
7: System.out. Println ( " Hello World Java " ) ;
8:
} 9:}
10:
any program in Java (even a simple "Hello World") should be a class because it is a strongly object-oriented language.
The "printf" Java is the
System.out.println .
main function should be public and static (topics discussed in chapter of objects). The comments, braces and semicolon "are identical to C (you can also comment with" / / "as in C + +).
Numeros.c 1:
2: # include < stdio.h >
3:
4: int main ( int argc , char * * argv )
5: {
6: int i , n ;
7: if ( argc < 2 )
8: {
9: printf ( " must pass the argument " ) ;
10: return 0 ;
11:}
12:
13: n = atoi (argv [ 1 ] ) ;
14: for ( i = 0 ; i < n ; i + + )
15: {
16: printf ( " %d\n " , i ) ;
17: }
18: return 0 ;
19: }
20:
Numeros.java 1:
2: import java.lang.*;
3:
4: public class Numeros
5: {
6: public static void main ( String args[] )
7: {
8: int i,n;
9:
10: if ( args.length < 1 )
11: {
12: System.out. Println ( " must pass the argument " ) ;
13: return;
14: }
15:
16: n = Integer. parseInt ( args [0 ] ) ;
17: for ( i = 0 ; i \u0026lt; n, i + + )
18: {
19: System.out. println (i ) ;
20:}
21:
} 22:}
23:
In this example we see that
for and if
are the same as in C. The "atoi" function (to convert strings to integer values) in Java is the
Integer.parseInt .
J2EE (or JEE) - "Java Enterprise Edition J2EE is an extension of Java to facilitate the development of business applications
understanding" Enterprise Application "as an application marked by a significant level of non-functional requirements
.
For example, if we talk about application of "home banking", a functional requirement might be "given an account number to show her every move" but the functional requirement can be bounded with a non-functional requirement, saying "In addition, the screen showing the movement must be issued within 3 seconds. " It follows
indicates that enterprise applications should have good response, good performance and other skills (together) are, know as attributes of an architecture. Availability
-
-
- Reliability Scalability Security
-
That is, an enterprise application should always be available for access, must support load increases (though we are not cost too much), should be safe, etc. .
To meet all these requirements, enterprise applications run on a
operating environment consisting of different servers such as: database servers, messaging servers, naming and directory servers, transaction, etc.
J2EE provides APIs so that from our Java programs can interact with available services in a corporate computing environment.
The graph shows how an application accesses enterprise services (operating environment) through the various APIs provided by J2EE.
addition, through technology interfaces
instances and factories (factory method
) J2EE allows Java programs to access the servers that make up the operating environment without the programmer having to worry about the brand or manufacturer.
The manufacturer of the product (eg Oracle) must provide a driver through which to connect to your (in this case) database. The driver is in the middle between the database and a set of methods defined in the J2EE APIs in different interfaces so that our program accesses driver services only through methods defined these APIs. This allows the driver just changing our program to connect to another database without having to make any other changes.
are also part of J2EE APIs to generate dynamic web content. Servlets and JSP .
.