Friday, November 18, 2016

Core Java[Session5]


  1. Constants

  2. Constant is a fixed value.

  3. There are 3 types of constants.

  4. i)character
  5. ii)Numeric
  6. iii)Boolean



  7. character constants
  8. -------------------
  9. character constants are 

  10. i)words.
  11. ii)alphabets[a-z,A-Z].
  12. iii)digits[0-9].
  13. iv)special symbols.

  14. character constants are of 2 types.

  15. i)single character constants
  16. ii)String constants.

  17. i)single chracter constant
  18. --------------------------
  19. single character enclosed in single quotes is known as 
  20. single character constant.

  21. ex:
  22.   'a'
  23.   'x'
  24.   '5'
  25.   '*'
  26.   ''
  27.    '10'(ic)
  28.    'abc'(ic)

  29. String constants
  30. ----------------
  31. group of letters enclosed in double quotes is known as 
  32. string constant.

  33. ex:
  34.    "satya"
  35.    "satya123"
  36.    ""
  37.    " "
  38.    "a"
  39.    "12345"
  40.    

  41. Numeric constants
  42. -----------------
  43. All numbers are numeric constants

  44. They are 2 types 

  45. Integer constant

  46. decimal/real/floating-point constant.

  47. Integer constant
  48. ----------------
  49. Number without fractional part is called integer constant.

  50. ex:
  51. 10
  52. 20 
  53. 56

  54. decimal constant.
  55. -----------------
  56. Number with fractional part is called decimal constant.

  57. ex:10.7 
  58. 5.6



No comments: