Topic 02: Genesis and Structure of Java
Upcoming SlideShare
Loading in...5
×

Like this? Share it with your network

Share

Topic 02: Genesis and Structure of Java

  • 590 views
Uploaded on

Softwarica Slides

Softwarica Slides

More in: Education
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
590
On Slideshare
288
From Embeds
302
Number of Embeds
4

Actions

Shares
Downloads
25
Comments
0
Likes
0

Embeds 302

http://www.pradipkharbuja.com.np 298
https://m.facebook.com 2
http://webcache.googleusercontent.com 1
http://www.slideee.com 1

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. Topic 02 : Genesis and Structure of Java DDOOCP
  • 2. Terminologies › Interpreter › Compiler › Oak › Bytecode
  • 3. The Java Language › Java has a block structure › Java is strongly typed language. › Java allows the programmer to create their own data types. › Java is platform independent. › Instancing a class
  • 4. Test Class
  • 5. Test Class
  • 6. static Modifiers › A variable or method that is shared by all instances of a class is called a class variable or class method. › Class variable or class method in Java is declared using static keyword. › A class variable/method can be referred either through an instance of the class (like a normal instance variable) or through the full class name e.g. classname.variable or classname.method().
  • 7. static Modifier Example
  • 8. Math class 1. PI 1. abs 2. acos 3. asin 4. atan 5. ceil 6. cos 7. exp 8. floor 9. max 10. min 11. pow 12. random 13. rint 14. round 15. sin 16. sqrt 17. tan 18. toDegrees 19. toRadians • java.lang.Math • All methods and properties in Math class are static. • Automatically imported.
  • 9. String class 1. charAt 2. compareTo 3. compareToIgnoreCase 4. concat 5. endsWith 6. equals 7. equalsIgnoreCase 8. indexOf 9. lastIndexOf 10. length 11. matches 12. replace 13. replaceAll 14. replaceFirst 15. split 16. startsWith 17. substring 18. toCharArray 19. toLowerCase 20. toString 21. toUpperCase 22. trim 23. valueOf
  • 10. Color Class › java.awt.Color › static members 1. BLACK / black 2. BLUE / blue 3. WHITE / white 4. GREEN / green 5. YELLOW / yellow 6. ORANGE / orange 7. RED / red 8. PINK / pink 9. GRAY / gray 10.LIGHT_GRAY › Constructor › Color(int r, int g, int b) › Color(int rgb) › Color(int r, int g, int b, int a) › Color(float r, float g, float b) › Color(float r, float g, float b, float a)
  • 11. Questions › Generate and display 20 random integers in the range 200 to 500. › WAP to display following output.
  • 12. Solution contd…
  • 13. Questions › Build a GUI to include three JButtons and a JTextField. › Set their titles to RED, Green and BLUE respectively. When a button is clicked, the background colour of the text field should change accordingly.
  • 14. References › http://docs.oracle.com/javase/7/docs/api/java/awt/Color.html