SlideShare a Scribd company logo
1 of 7
CS3135/CS2135
Object Oriented Programming (Java)
BSCS-3 / MCS-3
Lecture # 16
Math
Timer
Math
java.lang.Math (no need to import)
• double cos(double)
• double sin(double)
• double tan(double)
• double log(double)
• double log10(double)
• int max(int, int)
• float max(float, float)
• int min(int, int)
• float min(float, float)
• double pow(double, double)
• double sqrt(double)
• int round(float)
• long round(double)
• double random() // >=0.0 and <1
• double random() * integer value // >=0 and < integer value
• double random() * (max - min) // >=min integer value and < max integer value
Instructor: Tanzila Kehkashan
2
Instructor: Tanzila Kehkashan
3
Timer In Java
java.util.Timer
• Timer()
• void schedule(TimerTask, Date) //Schedules specified task for execution at the specified time.
• void schedule(TimerTask, Date, long) //Schedules specified task for repeated fixed-delay execution,
beginning at the specified time. Long is time in milliseconds between successive task executions.
• void schedule(TimerTask, long) //Schedules the specified task beginning after the specified delay.
• void schedule(TimerTask, long, long) //Schedules the specified task for repeated fixed-delay execution,
beginning after the specified delay.
• void cancel() //Terminates this timer, discarding any currently scheduled tasks.
java.util.TimerTask
• TimerTask()
• void run() //The action to be performed by this timer task.
• boolean cancel() //Cancels this timer task.
Instructor: Tanzila Kehkashan
4
Instructor: Tanzila Kehkashan
5
Try It !
Instructor: Tanzila Kehkashan
6
Instructor: Tanzila Kehkashan
7

More Related Content

Similar to OOP Lecture 16-Math,Timer.pptx

Week 6 java script loops
Week 6   java script loopsWeek 6   java script loops
Week 6 java script loops
brianjihoonlee
 

Similar to OOP Lecture 16-Math,Timer.pptx (20)

Awesomeness of JavaScript…almost
Awesomeness of JavaScript…almostAwesomeness of JavaScript…almost
Awesomeness of JavaScript…almost
 
Introduction to Ruby Programming Language
Introduction to Ruby Programming LanguageIntroduction to Ruby Programming Language
Introduction to Ruby Programming Language
 
Coscup2021-rust-toturial
Coscup2021-rust-toturialCoscup2021-rust-toturial
Coscup2021-rust-toturial
 
WEB222-lecture-4.pptx
WEB222-lecture-4.pptxWEB222-lecture-4.pptx
WEB222-lecture-4.pptx
 
Metaprogramming
MetaprogrammingMetaprogramming
Metaprogramming
 
Clojure intro
Clojure introClojure intro
Clojure intro
 
Scala introduction
Scala introductionScala introduction
Scala introduction
 
Value Objects, Full Throttle (to be updated for spring TC39 meetings)
Value Objects, Full Throttle (to be updated for spring TC39 meetings)Value Objects, Full Throttle (to be updated for spring TC39 meetings)
Value Objects, Full Throttle (to be updated for spring TC39 meetings)
 
Lab 1 izz
Lab 1 izzLab 1 izz
Lab 1 izz
 
2 BytesC++ course_2014_c1_basicsc++
2 BytesC++ course_2014_c1_basicsc++2 BytesC++ course_2014_c1_basicsc++
2 BytesC++ course_2014_c1_basicsc++
 
JavaScript in 2016 (Codemotion Rome)
JavaScript in 2016 (Codemotion Rome)JavaScript in 2016 (Codemotion Rome)
JavaScript in 2016 (Codemotion Rome)
 
JavaScript in 2016
JavaScript in 2016JavaScript in 2016
JavaScript in 2016
 
R for Pirates. ESCCONF October 27, 2011
R for Pirates. ESCCONF October 27, 2011R for Pirates. ESCCONF October 27, 2011
R for Pirates. ESCCONF October 27, 2011
 
C# 7.x What's new and what's coming with C# 8
C# 7.x What's new and what's coming with C# 8C# 7.x What's new and what's coming with C# 8
C# 7.x What's new and what's coming with C# 8
 
Java/Scala Lab: Анатолий Кметюк - Scala SubScript: Алгебра для реактивного пр...
Java/Scala Lab: Анатолий Кметюк - Scala SubScript: Алгебра для реактивного пр...Java/Scala Lab: Анатолий Кметюк - Scala SubScript: Алгебра для реактивного пр...
Java/Scala Lab: Анатолий Кметюк - Scala SubScript: Алгебра для реактивного пр...
 
Node.js System: The Landing
Node.js System: The LandingNode.js System: The Landing
Node.js System: The Landing
 
Java Tutorial
Java Tutorial Java Tutorial
Java Tutorial
 
Matlab lec1
Matlab lec1Matlab lec1
Matlab lec1
 
Week 6 java script loops
Week 6   java script loopsWeek 6   java script loops
Week 6 java script loops
 
Dynamic memory allocation
Dynamic memory allocationDynamic memory allocation
Dynamic memory allocation
 

More from Tanzila Kehkashan

More from Tanzila Kehkashan (20)

OOP Lecture 25-Network Programming-Part2.pptx
OOP Lecture 25-Network Programming-Part2.pptxOOP Lecture 25-Network Programming-Part2.pptx
OOP Lecture 25-Network Programming-Part2.pptx
 
OOP Lecture 24-Network Programming-Part1.pptx
OOP Lecture 24-Network Programming-Part1.pptxOOP Lecture 24-Network Programming-Part1.pptx
OOP Lecture 24-Network Programming-Part1.pptx
 
OOP Lecture 23-JAR Files.pptx
OOP Lecture 23-JAR Files.pptxOOP Lecture 23-JAR Files.pptx
OOP Lecture 23-JAR Files.pptx
 
OOP Lecture 22-JApplet.pptx
OOP Lecture 22-JApplet.pptxOOP Lecture 22-JApplet.pptx
OOP Lecture 22-JApplet.pptx
 
OOP Lecture 21-Graphics, Audio.pptx
OOP Lecture 21-Graphics, Audio.pptxOOP Lecture 21-Graphics, Audio.pptx
OOP Lecture 21-Graphics, Audio.pptx
 
OOP Lecture 20-MultiThreading.pptx
OOP Lecture 20-MultiThreading.pptxOOP Lecture 20-MultiThreading.pptx
OOP Lecture 20-MultiThreading.pptx
 
OOP Lecture 19-JMenuBar.pptx
OOP Lecture 19-JMenuBar.pptxOOP Lecture 19-JMenuBar.pptx
OOP Lecture 19-JMenuBar.pptx
 
OOP Lecture 18-DB Connectivity-Part2.pptx
OOP Lecture 18-DB Connectivity-Part2.pptxOOP Lecture 18-DB Connectivity-Part2.pptx
OOP Lecture 18-DB Connectivity-Part2.pptx
 
OOP Lecture 17-DB Connectivity-Part1.pptx
OOP Lecture 17-DB Connectivity-Part1.pptxOOP Lecture 17-DB Connectivity-Part1.pptx
OOP Lecture 17-DB Connectivity-Part1.pptx
 
OOP Lecture 15-FileHandling,JFileChooser.pptx
OOP Lecture 15-FileHandling,JFileChooser.pptxOOP Lecture 15-FileHandling,JFileChooser.pptx
OOP Lecture 15-FileHandling,JFileChooser.pptx
 
OOP Lecture 14-ExceptionHandling.pptx
OOP Lecture 14-ExceptionHandling.pptxOOP Lecture 14-ExceptionHandling.pptx
OOP Lecture 14-ExceptionHandling.pptx
 
OOP Lecture 13-Color,Font,ImageIcon.pptx
OOP Lecture 13-Color,Font,ImageIcon.pptxOOP Lecture 13-Color,Font,ImageIcon.pptx
OOP Lecture 13-Color,Font,ImageIcon.pptx
 
OOP Lecture 12-EventHandling2.pptx
OOP Lecture 12-EventHandling2.pptxOOP Lecture 12-EventHandling2.pptx
OOP Lecture 12-EventHandling2.pptx
 
OOP Lecture 11-EventHandling1.pptx
OOP Lecture 11-EventHandling1.pptxOOP Lecture 11-EventHandling1.pptx
OOP Lecture 11-EventHandling1.pptx
 
OOP Lecture 10-JTable,JTabbedPane,LayoutManagers.pptx
OOP Lecture 10-JTable,JTabbedPane,LayoutManagers.pptxOOP Lecture 10-JTable,JTabbedPane,LayoutManagers.pptx
OOP Lecture 10-JTable,JTabbedPane,LayoutManagers.pptx
 
OOP Lecture 9-JComboBox,JList,JPanel.pptx
OOP Lecture 9-JComboBox,JList,JPanel.pptxOOP Lecture 9-JComboBox,JList,JPanel.pptx
OOP Lecture 9-JComboBox,JList,JPanel.pptx
 
OOP Lecture 8-JCheckBox,JRadioButton,JProgressBar.pptx
OOP Lecture 8-JCheckBox,JRadioButton,JProgressBar.pptxOOP Lecture 8-JCheckBox,JRadioButton,JProgressBar.pptx
OOP Lecture 8-JCheckBox,JRadioButton,JProgressBar.pptx
 
OOP Lecture 7-JTextField,JTextArea,JPassword,JButton.pptx
OOP Lecture 7-JTextField,JTextArea,JPassword,JButton.pptxOOP Lecture 7-JTextField,JTextArea,JPassword,JButton.pptx
OOP Lecture 7-JTextField,JTextArea,JPassword,JButton.pptx
 
OOP Lecture 6-JFrame,JScrollPane,JLabel.pptx
OOP Lecture 6-JFrame,JScrollPane,JLabel.pptxOOP Lecture 6-JFrame,JScrollPane,JLabel.pptx
OOP Lecture 6-JFrame,JScrollPane,JLabel.pptx
 
OOP Lecture 5-Inheritance,Dialogboxes,Parsing.pptx
OOP Lecture 5-Inheritance,Dialogboxes,Parsing.pptxOOP Lecture 5-Inheritance,Dialogboxes,Parsing.pptx
OOP Lecture 5-Inheritance,Dialogboxes,Parsing.pptx
 

Recently uploaded

AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
VictorSzoltysek
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
shinachiaurasa2
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
VishalKumarJha10
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
Health
 

Recently uploaded (20)

10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
 
ManageIQ - Sprint 236 Review - Slide Deck
ManageIQ - Sprint 236 Review - Slide DeckManageIQ - Sprint 236 Review - Slide Deck
ManageIQ - Sprint 236 Review - Slide Deck
 
LEVEL 5 - SESSION 1 2023 (1).pptx - PDF 123456
LEVEL 5   - SESSION 1 2023 (1).pptx - PDF 123456LEVEL 5   - SESSION 1 2023 (1).pptx - PDF 123456
LEVEL 5 - SESSION 1 2023 (1).pptx - PDF 123456
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdf
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfAzure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
 

OOP Lecture 16-Math,Timer.pptx

  • 1. CS3135/CS2135 Object Oriented Programming (Java) BSCS-3 / MCS-3 Lecture # 16 Math Timer
  • 2. Math java.lang.Math (no need to import) • double cos(double) • double sin(double) • double tan(double) • double log(double) • double log10(double) • int max(int, int) • float max(float, float) • int min(int, int) • float min(float, float) • double pow(double, double) • double sqrt(double) • int round(float) • long round(double) • double random() // >=0.0 and <1 • double random() * integer value // >=0 and < integer value • double random() * (max - min) // >=min integer value and < max integer value Instructor: Tanzila Kehkashan 2
  • 4. Timer In Java java.util.Timer • Timer() • void schedule(TimerTask, Date) //Schedules specified task for execution at the specified time. • void schedule(TimerTask, Date, long) //Schedules specified task for repeated fixed-delay execution, beginning at the specified time. Long is time in milliseconds between successive task executions. • void schedule(TimerTask, long) //Schedules the specified task beginning after the specified delay. • void schedule(TimerTask, long, long) //Schedules the specified task for repeated fixed-delay execution, beginning after the specified delay. • void cancel() //Terminates this timer, discarding any currently scheduled tasks. java.util.TimerTask • TimerTask() • void run() //The action to be performed by this timer task. • boolean cancel() //Cancels this timer task. Instructor: Tanzila Kehkashan 4
  • 6. Try It ! Instructor: Tanzila Kehkashan 6