1 / 14

Java Kickstart Session

Java Kickstart Session. Academic Liaison Cell 16 th Management Committee. Agenda. Warming up to programming in UNIX Introduction to Java Object Oriented Programming Exception(s) & maybe error message API – what is this?. Disclaimer. This is not a replacement for the module CS1020

oberon
Download Presentation

Java Kickstart Session

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Java KickstartSession Academic Liaison Cell 16th Management Committee

  2. Agenda • Warming up to programming in UNIX • Introduction to Java • Object Oriented Programming • Exception(s) & maybe error message • API – what is this?

  3. Disclaimer • This is not a replacement for the module CS1020 • You will not guarantee an A+ if you attend this module • This session does not cover everything about Java.

  4. UNIX Programming • Useful Commands: • pwd: print working directory (aka wru?) • mkdir: make directory (aka make folder) • rm: remove or delete • ls: list all files/folders • cp: copy. • Vim Editor • Different Modes • gg=G (aka. Go to top of doc. and indent to bottom) • :wq / :w / :q / :q! [Shift + Z + Z]

  5. Introduction to Java • Java is just another programming language • Difference lies in the JVM / Java Virtual Machine. • Variables: int/double/char/boolean/etc… • Method(s) / Function(s): • public static void main (String[] args) {…} • static: • a keyword to imply that this exists once and only once • void: • A keyword to imply that the return datatype is void • Basically it is saying it won’t return anything • public: access modifier

  6. Introduction to Java if (condition) {…} if (condition) {…} else {…} if (condition) {…} else { if (condition) {…} else {…} } for(initialization; termination; increment) {…} for( ; ; ) {…} // Infinite loop for(int number: numbers) {…} // foreach loop while(condition) {…} do {…} while(condition); switch(primitive variable) { case n:break; default:break; }

  7. Object Oriented • Java is an OOP based language. • In English, that means you are forced to create an object/template or something close to one in order to program in Java. Sample code: public class JavaKickstartSession { public static void main(String[] args) { System.out.println(“Hello Class!”); } }

  8. Objects • They have • Name(s) • Characteristics • Interaction with other objects Example: Computer Lab has a Name/identification, It also has a computers in it (how many?) People interact with it (they use the computers)

  9. Inheritance • Idea to reuse code – imagine inheriting something that is already in existence. Example public abstract class Animal {…} public class Cat extends Animal {…} public class Kitten extends Cat {…}

  10. Interface • Idea to agree on a certain way to do something public interface WarmBlooded {…} public class Cat extends Animal implements WarmBlooded {…}

  11. Encapsulation • In English: whatever it is interested in or related, can and may be tagged/defined together. Doing otherwise is violation of this “Encapsulation”

  12. Exception(s) • Error messages, but if you know where will go wrong, what is stopping you from preventing it from going wrong? try {…} catch (Exception error) {…} finally {…}

  13. API • Application Programming Interface • Google “Java API” Common Classes Scanner String ArrayList/Vector DecimalFormat Exceptions: NullPointerException, ArithmeticException, IllegalArgumentException, IndexOutOfBoundsException, NumberFormatException

  14. The End • Actually it is just the beginning. • Practice helps. • Clarify when in doubt • Google Inc is still an awesome teacher

More Related