CodeNotes for J# will introduce you to the J# language and demonstrate how Java language syntax can be used inside the .NET framework. In addition to basic J# syntax, this book provides an introduction to Windows Forms, ASP.NET, and Web Services; one chapter is dedicated to an extensive case study based on the Advanced Placement Computer Science program. Whether you are learning Java or simply want to apply your Java knowledge to the .NET framework, this book will get you started.
This edition of CodeNotes includes:
• A global overview of this technology and explanation of what problems it can be used to solve
• Real-world examples
• “How and Why” sections that provide hints, tricks, workarounds, and tips on what should be taken advantage of or avoided
• Instructions and classroom-style tutorials throughout from expert trainers and software developers
About the Author
Read an Excerpt
Java is an extremely popular, object-oriented programming language originally released by Sun Microsystems in 1995. Over the past eight years, its user base (and fan base) has grown steadily due to its simplicity and robustness, and it can be found inside everywhere from professional software development companies to businesses to high school and college classrooms.
With the release of .NET, Microsoft’s new framework for Windows software development, Microsoft has created an opportunity for Java developers to use the language they know, and yet take full advantage of the Microsoft Visual Studio Interactive Development Environment (VS.NET), which we will discuss later in this chapter. For the moment, you can think of Visual Studio .NET as a language-neutral development environment that assists you in writing code in any one of a number of languages. Regardless of the language you choose (J# in the case of this book) VS.NET will ultimately compile your code into a universal language called Microsoft Intermediate Language (MSIL). MSIL is very similar in principal to Java bytecode. However, MSIL has additional benefits in terms of cross-language development.
J# (pronounced jay-sharp) is the newest language to be supported by the Visual Studio .NET environment, and is essentially Java for the .NET framework. Not only does J# allow Java developers to program comfortably within the Microsoft Integrated Development Environment (IDE), it also allows them to take full advantage of the extensive libraries and capabilities inherent in the .NET framework. Like any .NET language, J# can be used to write ASP.NET (Active Server Pages for web applications, covered in Chapter 5) applications, web services (Chapter 6), ADO.NET data applications(Chapter 8), and a host of other.NET target types. Keep in mind that the J# compiler understands the Java language, but ultimately compiles it to MSIL (instead of the bytecode you may be used to). Thus, the front end is Java, but the compiled results run on the Microsoft .NET framework as opposed to a Java Virtual machine. We will look at the similarities and differences between the Java framework and the .NET framework later in this chapter.
In this book we will look at how you, as a Java developer, can take advantage of J# and Visual Studio .NET to create Windows and web applications quickly. We will begin by examining the basics of the J# language. If you already know Java, these basics will be completely familiar. We will then examine how you can design graphical user interfaces (GUIs) for your applications using Windows forms and controls. We will also look at how J# can be used with ASP.NET to develop web applications, and .NET Web Services, which allow two applications to communicate with one another over the Internet using language-neutral protocols. Finally, we will apply what we have learned in this book to a major case study currently used in the Advanced Placement (AP) Computer Science Program common to many high schools (Chapter 7), and show how a traditional Java application can be extended using the features of Visual Studio .NET.
Please remember that this book is not intended as an introduction to the Java programming language, although we will briefly review the basics in Chapter 3. For the most part, we will assume that the reader has at least some knowledge of basic Java syntax and structure, and some experience in standard programming practices.