Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
8 views

JavaProgramming

Uploaded by

stacy russo
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

JavaProgramming

Uploaded by

stacy russo
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 16

AP/ITEC 2610 3.

00
Object Oriented
Programming
Lecture -1
Sept, 8th 2022 (4pm-7pm)
Java Programming Language

James Gosling
Creator of Java
Year of launch :
May 23, 1995; 27 years
ago

Company:
Sun Microsystems
(now a part of Oracle)
Features of Java
• Write once, run anywhere (WORA)
• any processor, any operating system
• Java programs even run in your web browser
• similar syntax to C/C++
• secure environment
• highly object oriented
Drawbacks of Java
• Java compiles to byte code and executed by a Java Virtual Machine
• slower than native machine code
• not interactive like an interpreted language like Python
• Totally ‘object oriented’
• you can’t do anything without ‘objects’
• No stand alone programs
• you need the whole Java environment to run even the simplest Java program
• Not lean and mean
• Java package is about 300MB, with 175MB of libraries
• Java is not very flexible
• e.g. the main program must be called Main.java
Installing Java
Follow the installation instructions for your specific OS
https://www.java.com/en/download/help/download_options.html
• Take note where Java is installed
• check the path for Java
• find the java compiler (javac.exe in Windows)
• use the where or whereis program to find java
• explore other executable programs (*.exe in Windows)
• run java from the command line
• run java using the complete path and full program name
Your first Java
Program
• Java is compiled from the command line
• try to create your first program with a
command line text editor
• like vi or emacs in Unix
• or Kit in Windows
• be sure you know where you save the
program
• use javac to compile the program
• use hex editor to look at compiled code
• read the text in the byte code
• run the Java program (*.class)
Finding java

Windows
Unix

Installing Geany – Text Editor


https://www.geany.org
Programming Tradition:

• The keyword public static void main is the means by which you create a
main method within the Java application. It's the core method of the
program and calls all others.
Compiling Java file (only once)

Check if a class file is created or not.


Running the source file
• Note that:
• Java interpreter expects the name of the class to execute, not the file
containing the class.
• If the filename is used in the command line, an error will show up!
Debug a Java program
• Install a Java IDE (integrated development environment)
• like NetBeans IDE
• Step through the Java code line by line
• Install a byte code viewer and disassembler
• Such as Krakatau (which uses Python) or dirtyJOE
• Step through the byte code instruction by instruction
Exercises
1. Change the text message in the compiled Java program
• use a Hex Editor, such as HexWorkshop
• in unix you can use the command line tool xxd
2. (i) Use the tools you have learned about to compile a simple Java
program, and decipher the ‘magic code’ at the start of the byte
code of each program.
(ii) Describe the syntax of the ‘magic’ code.
Course Topics
• Designing a class, Objects, Methods and Variables
• Run GUI using Java – Fun and easy
• Inheritance
• File handling
• Advance io
• Interfaces
• Recursion
Evaluation Criteria:
Assignments 30%
In-Person Mid-term Test 20%
Class Participation 10%
In- Person Final Examination 40%
*Make up Assignment - 1
There is no make up for course Mid-term and
Final Exam
Contact Information:
• E-class
* Lectures, Announcements , Assignment uploads ,
Grade posts etc..
• E-mail :
as14@yorku.ca (*should be used for personal
reasons only)
Zoom contact:
https://yorku.zoom.us/j/5341341558?
pwd=YWpXcFBhZjhCT0psVUhtRWxPMDFZZz09
• Office Hours: Thursdays [2pm- 3pm] * on Zoom.
• TA Contact: Coming up….
Academic Integrity:
https://www.yorku.ca/secretariat/policies/polici
es/academic-honesty-senate-policy-on/

• No Plagiarism
• No Cheating
• Delays in your final grades or No grade at all.

You might also like