Saturday, March 14, 2009

CORE JAVA

The Core Java technologies and application programming interfaces (APIs) are the foundation of the Java Platform, Standard Edition (Java SE). They are used in all classes of Java programming, from desktop applications to Java EE applications. See the other tabs above for information on other technologies included in Java SE.


Tip: Experienced Java programmers can quickly get to a component's documentation: Locate and click the technology in the documentation diagram. Documentation packages for previous releases are also available: J2SE 1.3.1, J2SE 1.4.2, J2SE 5.0.














Java DB
Java DB is Sun's supported distribution of the open source Apache Derby database. Its ease of use, standards compliance, full feature set, and small footprint make it the ideal database for Java developers. Java DB is written in the Java programming language, providing "write once, run anywhere" portability. It can be embedded in Java applications, requiring zero administration by the developer or user. It can also be used in client server mode. Java DB is fully transactional and provides a standard SQL interface as well as a JDBC 4.0 compliant driver.


Java Data Objects (JDO)
The Java Data Objects (JDO) API is a standard interface-based Java model abstraction of persistence. Application programmers can use JDO technology to directly store Java domain model instances into the persistent store (database). Benefits include ease of programming, application portability, database independence, high performance, and optional integration with Enterprise JavaBeans (EJB). JDO has been developed under Java Specification Request 12 (JSR 12) and Java Specification Request 243 (JSR 243). Beginning with JDO 2.0, the development of the API and the Technology Compatibility Kit (TCK) takes place within the Apache JDO open-source project.


The Java Database Connectivity (JDBC)
The Java Database Connectivity (JDBC) API is the industry standard for database-independent connectivity between the Java programming language and a wide range of databases – SQL databases and other tabular data sources, such as spreadsheets or flat files. The JDBC API provides a call-level API for SQL-based database access.


JDBC technology allows you to use the Java programming language to exploit "Write Once, Run Anywhere" capabilities for applications that require access to enterprise data. With a JDBC technology-enabled driver, you can connect all corporate data even in a heterogeneous environment.
JDBC documentation: J2SE 1.4.2 | J2SE 5.0 | Java SE 6
See Also:
JDBC Overview
Industry Support
JDBC Drivers
FAQ
Articles
Books
Forums
Learning JDBC
Sample Code


Java SE Desktop Overview

Desktop Java technologies can be used to create rich client applications and applets that are fast, secure, and portable. This page introduces all of these technologies.Most of the technologies are included as part of Java SE (also known as the JRE, or Java Runtime Environment), which is pre-installed on over 90% of all desktop systems on a wide range of operating systems. Other Desktop Java technologies are available as either separate downloadable Java extensions, or as open source projects on java.net. Finally, the Netbeans IDE with its integrated GUI builder brings everything together, allowing you to easily build your desktop application.

Community
Please visit the
JavaDesktop.org community on java.net for the latest news and information for developers of client applications.
JavaDesktop Forums on java.net: This is our prime spot for discussing all things desktop. It mixes Q&A with advanced developer discussions, such as the direction and future of Java on the desktop. Many of the Desktop Java engineers at Sun participate on these forums.
Java Forums on the Sun Developer Network (SDN): More of a Q&A forum, this is a great resource for both beginning and advanced developers.


Technology Overview
Java Web Start / JNLP

Java Web Start software provides a flexible and robust deployment solution for Java technology-based applications based on the Java Community Process program (JCP). The technology is being developed through the JCP program as JSR-56: The Java Network Launching Protocol & API (JNLP), which provides a browser-independent architecture for deploying Java 2 technology-based applications to the client desktop. Read More


Included in the Java SE platform


Java Plug-in technology, included as part of the Java 2 Runtime Environment, Standard Edition (JRE), establishes a connection between popular browsers and the Java platform. This connection enables applets on Web sites to be run within a browser on the desktop.


Included in the Java SE platform


SwingThe Swing API provides a comprehensive set of GUI (Graphical User Interface) components and services which enables the development of commercial-quality desktop and Internet/Intranet applications. Swing is built on top of many of the other Desktop Java technologies found on this page, including JavaBeans, AWT, Java2D, Accessibility, and Internationalization. A great place to jump into Swing programming is The Swing Tutorial


Included in the Java SE platform


The Java 2D API is a set of classes for advanced 2D graphics and imaging, encompassing line art, text, and images in a single comprehensive model. The API provides extensive support for image compositing and alpha channel images, a set of classes to provide accurate color space definition and conversion, and a rich set of display-oriented imaging operators.


Included in the Java SE platform


Java 3D™ API provides a set of object-oriented interfaces that support a simple, high-level programming model you can use to build, render, and control the behavior of 3D objects and visual environments. With the Java 3D API, you can incorporate high-quality, scalable, platform-independent 3D graphics into applications and applets based on Java technology.



CORE JAVA CODE



Program 1
//Find Maximum of 2 nos.
class Maxof2{
public static void main(String args[]){
//taking value as command line argument.
//Converting String format to Integer value
int i = Integer.parseInt(args[0]);
int j = Integer.parseInt(args[1]);
if(i > j)
System.out.println(i+" is greater than "+j);
else
System.out.println(j+" is greater than "+i);
}
}
Program 2
//Find Minimum of 2 nos. using conditional operator

class Minof2{
public static void main(String args[]){
//taking value as command line argument.
//Converting String format to Integer value
int i = Integer.parseInt(args[0]);
int j = Integer.parseInt(args[1]);
int result = (iProgram 3
/* Write a program that will read a float type value from the keyboard and print the following output.
->Small Integer not less than the number.
->Given Number.
->Largest Integer not greater than the number.
*/
class ValueFormat{
public static void main(String args[]){
double i = 34.32; //given number
System.out.println("Small Integer not greater than the number : "+Math.ceil(i));
System.out.println("Given Number : "+i);
System.out.println("Largest Integer not greater than the number : "+Math.floor(i));
}
Program 4
/*Write a program to generate 5 Random nos. between 1 to 100, and it
should not follow with decimal point
.
*/
class RandomDemo{
public static void main(String args[]){
for(int i=1;i<=5;i++){ System.out.println((int)(Math.random()*100)); } } } Program 5
/* Write a program to display a greet message according to
Marks obtained by student.
*/
class SwitchDemo{
public static void main(String args[]){
int marks = Integer.parseInt(args[0]); //take marks as command line argument.
switch(marks/10){
case 10:
case 9:
case 8:
System.out.println("Excellent");
break;
case 7:
System.out.println("Very Good");
break;
case 6:
System.out.println("Good");
break;
case 5:
System.out.println("Work Hard");
break;
case 4:
System.out.println("Poor");
break;
case 3:
case 2:
case 1:
case 0:
System.out.println("Very Poor");
break;
default:
System.out.println("Invalid value Entered");
}
}
}
Program 6
/*Write a program to find SUM AND PRODUCT of a given Digit. */
class Sum_Product_ofDigit{
public static void main(String args[]){
int num = Integer.parseInt(args[0]); //taking value as command line argument.
int temp = num,result=0;
//Logic for sum of digit
while(temp>0){
result = result + temp;
temp--;
}
System.out.println("Sum of Digit for "+num+" is : "+result);
//Logic for product of digit
temp = num;
result = 1;
while(temp > 0){
result = result * temp;
temp--;
}
System.out.println("Product of Digit for "+num+" is : "+result);
}
}
Program 7
/*Write a program to Find Factorial of Given no. */
class Factorial{
public static void main(String args[]){
int num = Integer.parseInt(args[0]); //take argument as command line
int result = 1;
while(num>0){
result = result * num;
num--;
}
System.out.println("Factorial of Given no. is : "+result);
}
}
Program 8
/*Write a program to Reverse a given no. */
class Reverse{
public static void main(String args[]){
int num = Integer.parseInt(args[0]); //take argument as command line
int remainder, result=0;
while(num>0){
remainder = num%10;
result = result * 10 + remainder;
num = num/10;
}
System.out.println("Reverse number is : "+result);
}
}
Program 9
/*Write a program to find Fibonacci series of a given no.
Example :
Input - 8
Output - 1 1 2 3 5 8 13 21
*/
class Fibonacci{
public static void main(String args[]){
int num = Integer.parseInt(args[0]); //taking no. as command line argument.
System.out.println("*****Fibonacci Series*****");
int f1, f2=0, f3=1;
for(int i=1;i<=num;i++){ System.out.print(" "+f3+" "); f1 = f2; f2 = f3; f3 = f1 + f2; } } } Program 10
/* Write a program to find sum of all integers greater than 100 and
less than 200 that are divisible by 7 */
class SumOfDigit{
public static void main(String args[]){
int result=0;
for(int i=100;i<=200;i++){ if(i%7==0) result+=i; } System.out.println("Output of Program is : "+result); } }






No comments:

Post a Comment