Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Java Tutorial For Beginners - Step By Step | Java Basics | Java Certification Training | Edureka

1,110 views

Published on

** Java Certification Training: https://www.edureka.co/java-j2ee-soa-... **
This Edureka PPT on “Java Tutorial For Beginners” will give you a brief insight about Java and its various fundamental concepts along with their practical implementation. Through this tutorial, you will learn the following topics:
1. Introduction to Java
2. JVM vs JRE vs JDK
3. Java Fundamentals
4. Objects & Classes
5. Methods & Access Modifiers
6. Flow Of Control
7. Java Arrays

Published in: Technology
  • Login to see the comments

Java Tutorial For Beginners - Step By Step | Java Basics | Java Certification Training | Edureka

  1. 1. JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training
  2. 2. JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training 01 IntroductionTo Java 02 JVM vs JRE vs JDK 03 Java Fundamentals 04 Objects & Classes 05 Methods & Access Modifiers 06 Flow Of Control 07 Arrays Topics For Today’s Discussion
  3. 3. Introduction to JAva
  4. 4. JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training Introduction To Java High Level Programming Language Father of Java is James Gosling Released by Sun Microsystems in 1996 Write Once Run Anywhere (WORA) Originally called OAK Free and Open Source Software
  5. 5. JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training Features Of Java PortableRobustEasy Distributed Object Oriented Platform Independent MultithreadedInterpretedSecure
  6. 6. JVM vs JRE vs JDK
  7. 7. JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training ✓ JVM is an abstract machine that doesn’t exist physically ✓ Provides runtime environment to drive the Java Code or applications ✓ It compiles the Java code into bytecode ✓ It is platform dependent JVM vs JRE vs JDK Java Virtual Machine JVM
  8. 8. JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training ✓ JRE is the environment within which the JVM runs ✓ It contains a set of libraries + other files that JVM uses at runtime ✓ Also called Java RTE JRE JVM vs JRE vs JDK JVM Java Runtime Environment
  9. 9. JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training JDK JRE JVM vs JRE vs JDK JVM ✓ JDK is a software development environment which is used to develop Java applications and applets ✓ It contains Development Tools and JRE Java Development Kit
  10. 10. Objects & Classes
  11. 11. & Classes
  12. 12. JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training Java Objects An real-world entity that has state and behaviour is known as an object 01State It is the data (value) of an object Behavior02 It is the functionality) of an object 03 Identity The object identity is typically implemented via a unique ID that is used internally by the JVM CHARACTERISTICS
  13. 13. & Classes
  14. 14. Objects &
  15. 15. JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training Java Classes A class is a group of objects which have common properties class <class_name>{ field; method; }
  16. 16. JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training Java Classes A class may contain Fields Methods Constructors Blocks Nested Class & Interface class <class_name>{ field; method; }
  17. 17. Java Fundamentals Variables DataTypes Operators
  18. 18. JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training Variables DataTypes Operators Variable refers to the name of reserved memory area 1 2 3 Instance Variables Static Variables Local Variables Java Fundamentals - Variables
  19. 19. JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training Variables DataTypes Operators DataTypes Primitive Non-Primitive Boolean Numeric Character Integral Integer FloatingPoint boolean char byte short int long float double StringArray Java Fundamentals – Data Types
  20. 20. JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training Variables DataTypes Operators 2 31 4 5 6 7 Arithmetic Operators Bitwise Operators Logical Operators Relational Operators Ternary Operators Assignment Operators 8 + - * ? % ^ & | && || < > <= >= == != ? : = += -= *= /= %= &= ^= |= <<= >>= >>>= ++X --X X++ X-- +X –X ! ~ << >> >>> Shift Operators Unary Operators Java Fundamentals - Operators
  21. 21. Java Methods
  22. 22. JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training Java Methods A method is a set of code that is grouped together to perform a specific operation Pre Defined or Standard Library Methods User Defined Methods A method must be written inside a class Each method has its own signature Java provides two types of methods
  23. 23. JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training Java User Defined Methods Method Initialization Method Invocation To use a method, you need to perform two steps:
  24. 24. JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training Java Methods Method Initialization Method Invocation modifier returnType nameOfMethod (Parameter List) { // method body } ✓ A method can be parameterized or non-parameterized ✓ Method definition consists of a method header and a method body ✓ You can Overload Method i.e. Provide same name to more than one method but their data type or parameter list must be different
  25. 25. JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training Java Methods Method Initialization Method Invocation ✓ To use a method it needs to be invoked or called ✓ A method can be called in two ways: 1. Call by Value 2. Call by Reference ✓ When a program invokes a method, the program control gets transferred to the called method methodName() methodName(parameter1, parameter2...)
  26. 26. Access Modifiers
  27. 27. JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training Access Modifiers Access modifiers helps to restrict the scope of a class, constructor , variable , method or data member Default Public Private Protected
  28. 28. JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training Access Modifiers Default Public Private Protected Same class Same Package subclass Same Package non- subclass Different package subclass Different package non- subclass Yes Yes Yes Yes Yes No Yes Yes Yes No Yes Yes No No Yes Yes No No No Yes
  29. 29. My First Java Program
  30. 30. JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training My First Java Program class Demo{ public static void main(String args[]){ System.out.println("Hello Edureka!!!"); } } public static void main(String args[])
  31. 31. JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training public static void main String args[] My First Java Program public static void main(String args[])
  32. 32. JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training public static void main(String args[]) It is a keyword which identifies the class related thing It is used to define the Return Type of the Method It is the name of the method that is searched by JVM as a starting point for an application with a particular signature only It is the parameter to the main Method where the argument name could be anything It is the access modifier of the main method My First Java Program public static void main String args[] NOTE: main() in Java is the most important method as it is the entry point of any java program
  33. 33. For While DoWhile Iterative Statements
  34. 34. JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training For While DoWhile It is a control structure that allows us to repeat certain operations by incrementing and evaluating a loop counter Iterative Statements – For Loop Statement Initialization Condition Increment /Decrement False True START END
  35. 35. JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training For While DoWhile Iterative Statements – For Loop Syntax for(initialization; condition; incr/dcr) { code block; } Statement Initialization Condition Increment /Decrement False True START END
  36. 36. JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training For While DoWhile Iterative Statements – While Loop It is a control structure that allows us to specify that a certain statement is to be executed repetitively until the loop condition is false Statement Condition False True START END
  37. 37. JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training For While DoWhile Iterative Statements – While Loop Syntax while (boolean condition) { loop statements... } Statement Condition False True START END
  38. 38. JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training For While DoWhile Iterative Statements – Do While Loop It is a control structure that allows code to be executed repeatedly based on a given Boolean condition and tests the condition before executing the loop body Statement Condition False True START END
  39. 39. JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training For While DoWhile Iterative Statements – Do While Loop Statement Condition False True START END Syntax do{ //code to be executed } while(condition);
  40. 40. Conditional Statements If If-Else Switch
  41. 41. JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training If If-Else Switch Conditional Statements - If It is the simplest selection statement in the Java language that checks the condition and executes the loop if condition is true If Nested If
  42. 42. JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training If If-Else Switch Conditional Statements - If If is the most simple decision making statement that decides whether a certain statement or block of statements will be executed or not Body of If True False START END Test Expression Statement below If If Nested If
  43. 43. JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training If If-Else Switch Conditional Statements - If Syntax if(condition) { //Statements to execute if condition is true } If Nested If
  44. 44. JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training If If-Else Switch Conditional Statements - If It is an if statement or an if-else statement within an if statement If Nested If Body of If True False START END Test Expression Statement below If Body of Nested If Body of If True Nested Test Expression
  45. 45. JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training If If-Else Switch Conditional Statements - If Syntax if (condition1) { // Executes when condition1 is true if (condition2) { // Executes when condition2 is true } } If Nested If
  46. 46. JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training If If-Else Switch Conditional Statements - If Else It is an upgraded if statement that tests the condition and if the condition is false then ‘else’ statement is executed If-Else If-Else-If Ladder
  47. 47. JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training If If-Else Switch Conditional Statements - If Else It tests the condition and if the condition is false then ‘else’ statement is executed If-Else If-Else-If Ladder True False START END Test Expression Statement below If Body of ElseBody of If
  48. 48. JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training If If-Else Switch Conditional Statements - If Else If-Else If-Else-If Ladder Syntax if (condition) { //Executes this block if condition is true } else { //Executes this block if condition is false }
  49. 49. JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training If If-Else Switch Conditional Statements - If Else If-Else If-Else-If Ladder If-else-if ladder allows the user to use many if else statement within a loop and in case one of the condition holds true the rest of the loops is bypassed True False START Statement below If-else-if Statement 1 Test Expression Test Expression Test Expression Statement 2 Statement 3 Body of Else False True True
  50. 50. JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training If If-Else Switch Conditional Statements - If Else If-Else If-Else-If Ladder Syntax if (condition) { statement; } else if (condition) { statement; } . . else statement;
  51. 51. JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training If If-Else Switch Conditional Statements - Switch The switch statement provides an easy way to execute conditions to different parts of the code True START Switch Condition 1 Condition n Default Condition 2 Statement 1 break; Statement 2 break; Statement n break; Default Statement True True True False False False Statement just below Switch Case
  52. 52. JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training If If-Else Switch Conditional Statements - Switch Syntax switch (expression) { case value1: statement1; break; case value2: statement2; break; . . case valueN: statementN; break; default: statementDefault; }
  53. 53. Jump Statements break continue return
  54. 54. Jump Statements break continue return
  55. 55. JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training break continue return Jump Statements - break The break construct is used to break out of the middle of loops After a break, all the remaining statements in the loop are skipped and the execution continues with the immediate next statement outside the loop It is used in loops (while, for, do-while) and in a switch case
  56. 56. JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training break continue return Jump Statements - break Syntax if(condition) { break; } Remaining body of loop Statement below loopBreak? Test Expression True No Yes
  57. 57. JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training break continue return Jump Statements – continue Continue statement is used to skip execution of statements within a loop It doesn’t terminate the loop but just skips some part of it to start the next iteration
  58. 58. JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training break continue return Jump Statements – continue Remaining body of loop Statement below loop Continue? Test Expression True No Yes Syntax if(condition) { continue; }
  59. 59. JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training break continue return Jump Statements – return The return statement is used to end the execution of a specific method and then return a value It sends the program control back to the method caller The data type of the returned value should always be equal to the data type of the method's declared return value Syntax if(condition) { return; }
  60. 60. Java Arrays 1D 2D
  61. 61. JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training Java Arrays – 1 Dimensional 1D 2D Array is an object which contains fixed number of elements of a similar data type under same name arrayRefVar = new dataType[arraySize]; =myArray new int[5] myArray[0] myArray[1] myArray[2] myArray[3] myArray[4] =myArray[0] 10
  62. 62. JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training 1D 2D Array is an object which contains fixed number of elements of a similar data type under same name arrayRefVar = new dataType[arraySize]; =myArray new int[5] myArray[0] myArray[1] myArray[2] myArray[3] myArray[4] =myArray[2] 10 30 =myArray[3] 40 =myArray[4] 50 =myArray[1] 20 Java Arrays – 1 Dimensional
  63. 63. JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training 1D 2D Array is an object which contains fixed number of elements of a similar data type under same name arrayRefVar = new dataType[arraySize]; =myArray new int[5] myArray[0] myArray[1] myArray[2] myArray[3] myArray[4] 10 30 40 5020 Java Arrays – 1 Dimensional
  64. 64. JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training 1D 2D Java Arrays – 2 Dimensional Like a 1D array, a 2D array is also a collection of data cells, all of the same type, which can be given a single name datatype[][] arrayRefVar = new dataType[row][col]; =int[][] myArray new int[2][2] myArray[0][0] myArray[0][1] myArray[1][0] myArray[1][1] =myArray[0][0] 100
  65. 65. JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training 1D 2D Java Arrays – 2 Dimensional Like a 1D array, a 2D array is also a collection of data cells, all of the same type, which can be given a single name datatype[][] arrayRefVar = new dataType[row][col]; =int[][] myArray new int[2][2] myArray[0][0] myArray[0][1] myArray[1][0] myArray[1][1] =myArray[0][1] 200 100 =myArray[1][0] 300 =myArray[1][1] 400
  66. 66. JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training 1D 2D Java Arrays – 2 Dimensional Like a 1D array, a 2D array is also a collection of data cells, all of the same type, which can be given a single name datatype[][] arrayRefVar = new dataType[row][col]; =int[][] myArray new int[2][2] myArray[0][0] myArray[0][1] myArray[1][0] myArray[1][1] 200100 300 400

×