with eclipse IDE – Theory Part 1 ----------------------------------------------------------------------- MARK JOHN P. LADO Bachelor of Science in Information System Instructor – Colegio de San Antonio de Padua - Guinsay, Danao City, Cebu Philippines PROGRAMMING
What Is Java? • Java is built on C++ for a simple-to-use language • Java is a computer programming language. It enables programmers to write computer instructions using English-based commands instead of having to write in numeric codes. It’s known as a high-level language because it can be read and written easily by humans.
What Is Java? • Like English, Java has a set of rules that determine how the instructions are written. These rules are known as its syntax. Once a program has been written, the high-level instructions are translated into numeric codes that computers can understand and execute.
Who Created Java? • In the early 90s, Java, which originally went by the name Oak and then Green, was created by a team led by James Gosling for Sun Microsystems, a company now owned by Oracle. • Java was originally designed for use on digital mobile devices, such as cellphones. However, when Java 1.0 was released to the public in 1996, its main focus had shifted to use on the internet, providing interactivity with users by giving developers a way to produce animated web pages.
Who Created Java? • However, there have been many updates since version 1.0, like J2SE 1.3 in 2000, J2SE 5.0 in 2004, Java SE 8 in 2014, and Java SE 10 in 2018. • Over the years, Java has evolved as a successful language for use both on and off the internet.
Why Choose Java? • Java was designed with a few key principles in mind: • Ease of Use: The fundamentals of Java came from a programming language called C++. Although C++ is a powerful language, it is complex in its syntax and inadequate for some of Java's requirements. Java built on and improved the ideas of C++ to provide a programming language that was powerful and simple to use.
Why Choose Java? • Java was designed with a few key principles in mind: • Reliability: Java needed to reduce the likelihood of fatal errors from programmer mistakes. With this in mind, object-oriented programming was introduced. When data and its manipulation were packaged together in one place, Java was robust.
Why Choose Java? • Java was designed with a few key principles in mind: • Security: Because Java was originally targeting mobile devices that would be exchanging data over networks, it was built to include a high level of security. Java is probably the most secure programming language to date.
Why Choose Java? • Java was designed with a few key principles in mind: • Platform Independence: Programs need to work regardless of the machines they're being executed on. Java was written to be a portable and cross-platform language that doesn't care about the operating system, hardware, or devices that it's running on.
Using Java Comments • All Programming Languages Support Comments Which are Ignored by the Compiler • Java comments are notes in a Java code file that are ignored by the compiler and runtime engine. They are used to annotate the code in order to clarify its design and purpose. You can add an unlimited number of comments to a Java file, but there are some "best practices" to follow when using comments.
Using Java Comments • All Programming Languages Support Comments Which are Ignored by the Compiler • Generally, code comments are "implementation" comments that explain the source code, such as descriptions of classes, interfaces, methods, and fields. These are usually a couple of lines written above or beside Java code to clarify what it does.
Using Java Comments • All Programming Languages Support Comments Which are Ignored by the Compiler • Another type of Java comment is a Javadoc comment. Javadoc comments differ slightly in syntax from implementation comments and are used by the program javadoc.exe to generate Java HTML documentation.
Question… •Why Use Java Comments?
Why Use Java Comments? • It's good practice to get into the habit of putting Java comments into your source code to enhance its readability and clarity for yourself and other programmers. It isn't always instantly clear what a section of Java code is performing. A few explanatory lines can drastically reduce the amount of time it takes to understand the code.
Question… •Do They Affect How The Program Runs?
Do They Affect How The Program Runs? • Implementation comments in Java code are only there for humans to read. Java compilers don't care about them and when compiling the program, they just skip over them. The size and efficiency of your compiled program will not be affected by the number of comments in your source code.
Implementation Comments Implementation comments come in two different formats: 1. Line Comments: For a one line comment, type "//" and follow the two forward slashes with your comment. For example: // this is a single line comment
Implementation Comments • When the compiler comes across the two forward slashes, it knows that everything to the right of them is to be considered as a comment. This is useful when debugging a piece of code.
Implementation Comments Implementation comments come in two different formats: 2. Block Comments: To start a block comment, type "/*". Everything between the forward slash and asterisk, even if it's on a different line, is treated as a comment until the characters "*/" end the comment.
Implementation Comments For example: /* this * is * a * block * comment */
Example Code with comment /*This is my first program in java * Another line here */​ public static void main(String[] args) { System.out.println ("Hello World!");​ }
4 Tips for Using Comments 1. Don't over comment. Every line of your program does not need to be explained. If your program flows logically and nothing unexpected occurs, don't feel the need to add a comment.
4 Tips for Using Comments 2. Indent your comments. If the line of code you are commenting is indented, make sure your comment matches the indentation.
4 Tips for Using Comments 3. Keep comments relevant. Some programmers are excellent at modifying code, but for some reason forget to update the comments. If a comment no longer applies, then either modify or remove it.
4 Tips for Using Comments 4. Don't nest block comments. The following will result in a compiler error:
Java Is Case Sensitive • Case Sensitivity in Programming Languages is Common • Java is a case-sensitive language, which means that the upper or lower case of letters in your Java programs matter.
Java Is Case Sensitive About Case Sensitivity • Case sensitivity enforces capital or lower case in text. For example, suppose you have created three variables called "endLoop", "Endloop", and "EndLoop". Even though these variables are composed of the exact same letters in the same exact order, Java does not consider them equal. It will treat them all differently.
Java Is Case Sensitive About Case Sensitivity • This behavior has its roots in the programming language C and C++, on which Java was based, but not all programming languages enforce case sensitivity. Those that do not include Fortran, COBOL, Pascal and most BASIC languages.
What are the types of Java? Data types in Java are classified into two types: • Primitive—which include Integer, Character, Boolean, and Floating Point. • Non-primitive—which include Classes, Interfaces, and Arrays.

Learn java theory presentation

  • 1.
    with eclipse IDE– Theory Part 1 ----------------------------------------------------------------------- MARK JOHN P. LADO Bachelor of Science in Information System Instructor – Colegio de San Antonio de Padua - Guinsay, Danao City, Cebu Philippines PROGRAMMING
  • 2.
    What Is Java? •Java is built on C++ for a simple-to-use language • Java is a computer programming language. It enables programmers to write computer instructions using English-based commands instead of having to write in numeric codes. It’s known as a high-level language because it can be read and written easily by humans.
  • 3.
    What Is Java? •Like English, Java has a set of rules that determine how the instructions are written. These rules are known as its syntax. Once a program has been written, the high-level instructions are translated into numeric codes that computers can understand and execute.
  • 4.
    Who Created Java? •In the early 90s, Java, which originally went by the name Oak and then Green, was created by a team led by James Gosling for Sun Microsystems, a company now owned by Oracle. • Java was originally designed for use on digital mobile devices, such as cellphones. However, when Java 1.0 was released to the public in 1996, its main focus had shifted to use on the internet, providing interactivity with users by giving developers a way to produce animated web pages.
  • 5.
    Who Created Java? •However, there have been many updates since version 1.0, like J2SE 1.3 in 2000, J2SE 5.0 in 2004, Java SE 8 in 2014, and Java SE 10 in 2018. • Over the years, Java has evolved as a successful language for use both on and off the internet.
  • 6.
    Why Choose Java? •Java was designed with a few key principles in mind: • Ease of Use: The fundamentals of Java came from a programming language called C++. Although C++ is a powerful language, it is complex in its syntax and inadequate for some of Java's requirements. Java built on and improved the ideas of C++ to provide a programming language that was powerful and simple to use.
  • 7.
    Why Choose Java? •Java was designed with a few key principles in mind: • Reliability: Java needed to reduce the likelihood of fatal errors from programmer mistakes. With this in mind, object-oriented programming was introduced. When data and its manipulation were packaged together in one place, Java was robust.
  • 8.
    Why Choose Java? •Java was designed with a few key principles in mind: • Security: Because Java was originally targeting mobile devices that would be exchanging data over networks, it was built to include a high level of security. Java is probably the most secure programming language to date.
  • 9.
    Why Choose Java? •Java was designed with a few key principles in mind: • Platform Independence: Programs need to work regardless of the machines they're being executed on. Java was written to be a portable and cross-platform language that doesn't care about the operating system, hardware, or devices that it's running on.
  • 10.
    Using Java Comments •All Programming Languages Support Comments Which are Ignored by the Compiler • Java comments are notes in a Java code file that are ignored by the compiler and runtime engine. They are used to annotate the code in order to clarify its design and purpose. You can add an unlimited number of comments to a Java file, but there are some "best practices" to follow when using comments.
  • 11.
    Using Java Comments •All Programming Languages Support Comments Which are Ignored by the Compiler • Generally, code comments are "implementation" comments that explain the source code, such as descriptions of classes, interfaces, methods, and fields. These are usually a couple of lines written above or beside Java code to clarify what it does.
  • 12.
    Using Java Comments •All Programming Languages Support Comments Which are Ignored by the Compiler • Another type of Java comment is a Javadoc comment. Javadoc comments differ slightly in syntax from implementation comments and are used by the program javadoc.exe to generate Java HTML documentation.
  • 13.
  • 14.
    Why Use JavaComments? • It's good practice to get into the habit of putting Java comments into your source code to enhance its readability and clarity for yourself and other programmers. It isn't always instantly clear what a section of Java code is performing. A few explanatory lines can drastically reduce the amount of time it takes to understand the code.
  • 15.
    Question… •Do They AffectHow The Program Runs?
  • 16.
    Do They AffectHow The Program Runs? • Implementation comments in Java code are only there for humans to read. Java compilers don't care about them and when compiling the program, they just skip over them. The size and efficiency of your compiled program will not be affected by the number of comments in your source code.
  • 17.
    Implementation Comments Implementation commentscome in two different formats: 1. Line Comments: For a one line comment, type "//" and follow the two forward slashes with your comment. For example: // this is a single line comment
  • 18.
    Implementation Comments • Whenthe compiler comes across the two forward slashes, it knows that everything to the right of them is to be considered as a comment. This is useful when debugging a piece of code.
  • 19.
    Implementation Comments Implementation commentscome in two different formats: 2. Block Comments: To start a block comment, type "/*". Everything between the forward slash and asterisk, even if it's on a different line, is treated as a comment until the characters "*/" end the comment.
  • 20.
    Implementation Comments For example: /*this * is * a * block * comment */
  • 21.
    Example Code withcomment /*This is my first program in java * Another line here */​ public static void main(String[] args) { System.out.println ("Hello World!");​ }
  • 22.
    4 Tips forUsing Comments 1. Don't over comment. Every line of your program does not need to be explained. If your program flows logically and nothing unexpected occurs, don't feel the need to add a comment.
  • 23.
    4 Tips forUsing Comments 2. Indent your comments. If the line of code you are commenting is indented, make sure your comment matches the indentation.
  • 24.
    4 Tips forUsing Comments 3. Keep comments relevant. Some programmers are excellent at modifying code, but for some reason forget to update the comments. If a comment no longer applies, then either modify or remove it.
  • 25.
    4 Tips forUsing Comments 4. Don't nest block comments. The following will result in a compiler error:
  • 26.
    Java Is CaseSensitive • Case Sensitivity in Programming Languages is Common • Java is a case-sensitive language, which means that the upper or lower case of letters in your Java programs matter.
  • 27.
    Java Is CaseSensitive About Case Sensitivity • Case sensitivity enforces capital or lower case in text. For example, suppose you have created three variables called "endLoop", "Endloop", and "EndLoop". Even though these variables are composed of the exact same letters in the same exact order, Java does not consider them equal. It will treat them all differently.
  • 28.
    Java Is CaseSensitive About Case Sensitivity • This behavior has its roots in the programming language C and C++, on which Java was based, but not all programming languages enforce case sensitivity. Those that do not include Fortran, COBOL, Pascal and most BASIC languages.
  • 29.
    What are thetypes of Java? Data types in Java are classified into two types: • Primitive—which include Integer, Character, Boolean, and Floating Point. • Non-primitive—which include Classes, Interfaces, and Arrays.