Upgrade to Pro — share decks privately, control downloads, hide ads and more …

CSE110 Lecture 03

CSE110 Lecture 03

Principles of Programming with Java
Classes, methods, and variables
(202205)

B546a9b97d993392e4b22b74b99b91fe?s=128

Javier Gonzalez
PRO

May 19, 2017
Tweet

More Decks by Javier Gonzalez

Other Decks in Programming

Transcript

  1. CSE110 Principles of Programming with Java Lecture 03: Classes, methods,

    and variables Javier Gonzalez-Sanchez javiergs@asu.edu javiergs.engineering.asu.edu | javiergs.com Office Hours: By appointment
  2. IDE Using IntelliJ

  3. Javier Gonzalez-Sanchez | CSE110 | Summer 2020 | 3 Previously…

  4. Javier Gonzalez-Sanchez | CSE110 | Summer 2020 | 4 Previously…

  5. Javier Gonzalez-Sanchez | CSE110 | Summer 2020 | 5 Previously…

  6. Javier Gonzalez-Sanchez | CSE110 | Summer 2020 | 6 Previously…

  7. Javier Gonzalez-Sanchez | CSE110 | Summer 2020 | 7 Previously…

  8. Javier Gonzalez-Sanchez | CSE110 | Summer 2020 | 8 Previously…

  9. Javier Gonzalez-Sanchez | CSE110 | Summer 2020 | 9 Previously…

  10. IDE Using Eclipse

  11. Javier Gonzalez-Sanchez | CSE110 | Summer 2020 | 11 Previously…

  12. Javier Gonzalez-Sanchez | CSE110 | Summer 2020 | 12 Previously…

  13. Javier Gonzalez-Sanchez | CSE110 | Summer 2020 | 13 Previously…

  14. Javier Gonzalez-Sanchez | CSE110 | Summer 2020 | 14 Previously…

  15. Javier Gonzalez-Sanchez | CSE110 | Summer 2020 | 15 Previously…

  16. Javier Gonzalez-Sanchez | CSE110 | Summer 2020 | 16 Previously…

  17. Javier Gonzalez-Sanchez | CSE110 | Summer 2020 | 17 Previously…

  18. Javier Gonzalez-Sanchez | CSE110 | Summer 2020 | 18 Previously…

  19. Javier Gonzalez-Sanchez | CSE110 | Summer 2020 | 19 Previously…

  20. Javier Gonzalez-Sanchez | CSE110 | Summer 2020 | 20 Previously…

  21. IDE Using TutorialsPoint.com

  22. Javier Gonzalez-Sanchez | CSE110 | Summer 2020 | 22 Previously…

  23. Java Classes, Methods and Variables

  24. Javier Gonzalez-Sanchez | CSE110 | Summer 2020 | 24 Java

    Program Structure • A program is made up of one or more classes • A class contains one or more methods • A method contains program statements
  25. Javier Gonzalez-Sanchez | CSE110 | Summer 2020 | 25 Java

    Program Structure • program statements can be: • Variables – places to store information • Instructions – actions to be done
  26. Javier Gonzalez-Sanchez | CSE110 | Summer 2020 | 26 Previously…

    and static public class TheClassName { } public static void theFirstMethodName() { } public static void secondMethodName(){ } // instructions go here // instructions go here // variables go here // variables go here // variables go here public static void main( ) { } // instructions go here // variables go here
  27. Javier Gonzalez-Sanchez | CSE110 | Summer 2020 | 27 Example

    without main()
  28. Javier Gonzalez-Sanchez | CSE110 | Summer 2020 | 28 main()

    method • All programs should have one and only one main() method. • Trying to execute a class without a main() method generates a compilation error
  29. Javier Gonzalez-Sanchez | CSE110 | Summer 2020 | 29 Example

    with main()
  30. Javier Gonzalez-Sanchez | CSE110 | Summer 2020 | 30 Example

    main() calling methods
  31. Javier Gonzalez-Sanchez | CSE110 | Summer 2020 | 31 Template

    public class TheClassName { } public static void theFirstMethodName() { } public static void secondMethodName(){ } // instructions go here // instructions go here // variables go here // variables go here // variables go here public static void main( ) { } // instructions go here // variables go here
  32. Javier Gonzalez-Sanchez | CSE110 | Summer 2020 | 32 Global

    Variable
  33. Javier Gonzalez-Sanchez | CSE110 | Summer 2020 | 33 Error

  34. Javier Gonzalez-Sanchez | CSE110 | Summer 2020 | 34 Homework

    Read Sections 2.1, 2.2, and 2.3
  35. CSE110 - Principles of Programming Javier Gonzalez-Sanchez javiergs@asu.edu Summer 2022

    Disclaimer. These slides can only be used as study material for the class CSE110 at ASU. They cannot be distributed or used for another purpose.