Java Programming 1 Monday, January 25th Computers A computer is controlled by a program. A program is written in some sort of programming language. Program features SYNTAX = form of the statements SEMANTICS = Meaning of the statements Java Code run through java compiler to get byte code. Java Virtual Machine gets loaded into memory and carries out the byte code. Java compiler is concerned with the syntax. Check code for errors and translates it into byte code. Syntactic objects which are meant as instructions the compiler. Semantics(run-time) objects are meant for Java Virtual Machine. Types of Java programs: Application: a program that's supposed t run on a single unit. Applet: Is meant to be run over the internet through the use of a web browser. Structure of MPG1. Structured as a public class. Name goes right after structure. *The name of the file should always be the same as the name of the class. Curly braces delimit the class. Syntax- { public static void main (String[]args) { Java statements to be done } ... What kind of run-time units are in an application? 1. Method - Behavior, the operation to be done. Everything starts out with one main method. It tels the computer where to start. (a behavior) All applications must start with one and only one main method. 2. Variables - Data values, or places to keep data values. They correspond to memory locations in the machine. 3. Expression - Expressions do computations. 4. Operators - Operators act on data to give some sort of result. 5. Statements - Statements are combinations Ops, Exps, Vars. They dictate what JVM is to do. 6. Objects - They combine data and behaviors into a single entity. A compiler arranges for a app object to created and when run... A standard output object how you output the object. 2. Compile-Time unit A run-time unit that has data and behavior. 1. Class is a blueprint to the compiler from which objects are built. An object is a combinational data behavioral thing during runtime 2. Variable Declaration - To allocate in memory a space where one can keep the value for a variable. ? Float is 32 point value, Double is 64 bit point value.
STUDYBLUE makes things that make you better at school.
Things like
online flashcards with photos and audio.
Things like personalized quizzes and friendly reminders about when (and what) to study next.
Think of it as a digital backpack™: access to all of your study materials online and on your phone.
STUDYBLUE exists to make studying efficient and effective for every student, for free.
Join us.
“I have used this website for three exams, and I see a huge difference in my test results.”
Naj