Mobile ITnT Solutions



4603752729865Java Developer IProgramClass Notes:Getting Started with Java & NetBeans-Part ONE00Java Developer IProgramClass Notes:Getting Started with Java & NetBeans-Part ONE4899508-232200-1270-2540mobile itnTSolutions, LLC.00mobile itnTSolutions, ics Covered:How to get started with Java and NetBeansIntro to JavaUsing NetBeans to work with existing projectsUsing NetBeans to develop new projectsIntroduction to Java1n 1996, Sun Microsystems released a new programming language called JavaSee Java timeline below:Throughout Java’s history, the terms Java Development Kit (JDK) and Software Development Kit (SDK) have been used to describe the Java toolkitJava toolkit or Java Development Toolkit is a program development environment for writing Java applets and applicationsConsists of a runtime environment that “sits on top” of the operating system layer as well as the tools and programming that developers need to compile, debug, and run applets and applications written in the Java languageDifferent numbering schemes have been used to indicate the version of JavaFor example: Java 5.0 and Java 6 refer to versions 1.5 and 1.6 of JavaThe current Standard Edition of Java is known as Java SEThe current Enterprise Edition of Java is known as Java EEThis Java program will show how to use Java SE 7, but it should also work for earlier and future versions of JavaOperating systems supported by Java:WindowsLinuxSolarisMacintosh OS XApplications, applets, and servlets:These figures describe the 3 types of programs you can create with JavaWhen you create these desktop apps, you can use a graphical user interface(GUI) to get user input and perform a calculation as shown hereThe console application: runs in the console, or command prompt, that’s available from your operating system, as shown here.One of the unique characters of Java is that you can use it to create a special type of web-based application known as an appletThis figure shows an applet that works the same way as the application above itThe main difference between an application and an applet is that an applet can be stored in an HTML page and can run inside a Java-enabled browserAs a result, you can distribute applets via the Internet or an intranetYou will learn how to create and deploy applets later in this programAlthough applets can be useful for creating a complex user interface within a browser, they have their limitationsYou usually need to install a plug-in on each client machine, which isn’t ideal for some types of applicationsSecond, since an applet runs within a browser on the client, it’s not ideal for working with resources that run on the server, such as enterprise databasesTo provide access to enterprise databases, many developers use Java EE to create applications that are based on servletsA servlet is a special type of Java application that runs on the server and can be called by a client, which is usually a web browserAs shown in our example, you can see that the servlet works much the same way as the appletThe main difference is that the code for the application runs on the serverWhen a web browser calls a servlet, the servlet performs its task and returns the result to the browser, typically in the form of an HTML pageFor example, suppose a browser requests a servlet that displays all unprocessed invoices that are stored in a databaseThen when the servlet is executed, it reads data from the database, formats that data within an HTML page, and returns the HTML page to the browserWhen you create a servlet-based application like the one shown here, all the processing takes place on the server and only HTML is returned to the browserTo make it easy to store the results of a servlet within an HTML page, the Java EE specification provides for JavaServer Pages (JSPs)Most developers use JSPs together with servlets when developing server-side Java applicationsJava Servlets and JSPs are covered in the Java Developer II programCode for the console version of the Future Value application:To give you an idea on how the code for a Java application works, our example here presents the code for the console version of the Future Value application…If you have no programming experience, don’t worry, you will learn all on how this code works in the next few video lessons. . .for now, here’s a brief explanation of this codeMost of the code for this application is stored in a class name FutureValueAppThis class begins with an opening brace ({) and ends with a closing brace (})Within this class, two methods are definedThese methods also begin with an opening brace and end with a closing brace, and they are indented to clearly show that they are contained within the classThe 1st method, named main, is the main method for the applicationThe code within this method is executed automatically when you run the applicationIn this case, the code displays the data the user sees on the console, accepts the data the user enters at the console, and calculates the future valueThe 2nd method is named calculateFutureValueThis method is called from the main method and calculates the future value based on the data the user entersExample below:Show real code in classHow Java compiles and interprets code:When you develop a Java application, you create one or more classesFor each class, you write the Java statements that direct the operation of the classThen, you use a Java tool to translate the Java statements into instructions that can be run by the computer, as show belowTo start, enter and edit the Java source code for a classThese are Java statements, like the Java code we just viewed, that tell the application what to doThen use the Java compiler to compile the source code into a format known as Java bytecodesAt this point, the bytecodes can be run on any platform that has a Java interpreter to interpret (or translate) the Java bytecodes into code that can be understood by the underlying operating systemIntroduction to Java IDEsTo develop Java apps, you typically use an Integrated Development Environment(IDE)Although you can use a simple text editor, an IDE provides features that can make developing Java applications considerably easierHere are some features of the most popular IDEsThe first two IDEs: Netbeans and Eclispe, are arguably the 2 most popular Java IDEsBoth IDEs help you complete your code and notify you on potential compile-time errorsThey both compile your code before you run itThey both include a debugger that lets you perform standard debugging functions like setting breakpoints, stepping through code, and viewing the values of variablesThe default installation of NetBeans provides a feature of building graphical user interfaces(GUI)To use this GUI builder, you can drag controls onto a form on the design surfaceThe last 3 IDEs shown aren’t as popular as NetBeans and EclipseOther Java IDEs are available as well that aren’t included in this listWe will be using NetBeans in this program. . .it’s more intuitive and easier to use than Eclipse ................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download