Util

464 views
374 views

Published on

util

Published in: Education
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
464
On SlideShare
0
From Embeds
0
Number of Embeds
5
Actions
Shares
0
Downloads
16
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Util

  1. 1. JAVA Utility Classes
  2. 2. Package java.util <ul><li>This package offers the below classes that handle various miscellaneous tasks. </li></ul><ul><ul><li>StringTokenizer </li></ul></ul><ul><ul><li>Date </li></ul></ul><ul><ul><li>Calendar </li></ul></ul><ul><ul><li>Random </li></ul></ul><ul><ul><li>Vector </li></ul></ul><ul><ul><li>Stack </li></ul></ul>
  3. 3. public class java.util.Stringtokenizer <ul><li>This class is used to tokenize a string with a given set of delimitors. </li></ul><ul><li>Public Constructors </li></ul><ul><ul><li>StringTokenizer(String); </li></ul></ul><ul><ul><li>StringTokenizer(String,String); </li></ul></ul><ul><ul><li>StringTokenizer(String,String,boolean); </li></ul></ul><ul><li>Public Methods </li></ul><ul><ul><li>boolean hasMoreTokens(); </li></ul></ul><ul><ul><li>String nextToken(); </li></ul></ul><ul><ul><li>int countTokens(); </li></ul></ul>
  4. 4. public class java.util.Random <ul><li>Generates pseudo random numbers </li></ul><ul><li>Public Constructors </li></ul><ul><ul><li>Random(); </li></ul></ul><ul><ul><li>Random(long seed); </li></ul></ul><ul><li>Public Methods </li></ul><ul><ul><li>int nextInt(int seed); </li></ul></ul><ul><ul><li>int nextLong(long seed); </li></ul></ul>
  5. 5. public class java.util.Date <ul><li>Represents Date values and has methods supporting date manipulations </li></ul><ul><li>Public Constructors </li></ul><ul><ul><li>Date(); </li></ul></ul><ul><ul><li>Date(long ms); </li></ul></ul><ul><ul><li>Date(int y,int m,int d); </li></ul></ul><ul><ul><li>Date(int y,int m,int d,int h,int m); </li></ul></ul><ul><ul><li>Date(int y,int m,int d,int h,int m,int s); </li></ul></ul><ul><ul><li>Date(String); </li></ul></ul>
  6. 6. Public Methods of public class java.util.Date <ul><li>int getYear(); </li></ul><ul><li>void setYear(int); </li></ul><ul><li>int getMonth(); </li></ul><ul><li>void setMonth(int); </li></ul><ul><li>int getDate(); </li></ul><ul><li>void setDate(int); </li></ul><ul><li>int getDay(); </li></ul><ul><li>int getHours(); </li></ul><ul><li>void setHours(int); </li></ul><ul><li>int getMinutes(); </li></ul><ul><li>void setMinutes(int); </li></ul><ul><li>int getSeconds(); </li></ul><ul><li>void setSeconds(int); </li></ul><ul><li>boolean before(Date); </li></ul><ul><li>boolean after(Date); </li></ul><ul><li>boolean equals(Date); </li></ul><ul><li>static long parse(String); </li></ul>
  7. 7. public abstract class java.util.Calendar <ul><li>This is a substitute class of the deprecated class Date. </li></ul><ul><li>Factory Method </li></ul><ul><ul><li>public static Calendar getInstence(); </li></ul></ul><ul><li>Public Methods </li></ul><ul><ul><li>int get(int field_constant); </li></ul></ul><ul><ul><li>void set(int field_constant,value_constant); </li></ul></ul>
  8. 8. public abstract class java.util.Calendar constants <ul><li>All Constants here are public static integers. </li></ul><ul><li>Field Constants </li></ul><ul><ul><li>ERA </li></ul></ul><ul><ul><li>YEAR </li></ul></ul><ul><ul><li>MONTH </li></ul></ul><ul><ul><li>WEEK_OF_YEAR </li></ul></ul><ul><ul><li>DATE </li></ul></ul><ul><ul><li>AM_PM </li></ul></ul><ul><ul><li>WEEK_OF_MONTH </li></ul></ul><ul><ul><li>DAY_OF_MONTH </li></ul></ul><ul><ul><li>HOUR </li></ul></ul><ul><ul><li>DAY_OF_YEAR </li></ul></ul><ul><ul><li>DAY_OF_WEEK </li></ul></ul><ul><ul><li>MINUTE </li></ul></ul><ul><ul><li>HOUR_OF_DAY </li></ul></ul><ul><ul><li>MILLISECOND </li></ul></ul><ul><ul><li>SECOND </li></ul></ul><ul><ul><li>DAY_OF_WEEK_IN_MONTH </li></ul></ul><ul><li>Value Constants </li></ul><ul><ul><li>SUNDAY to SATURDAY </li></ul></ul><ul><ul><li>JANUARY to DECEMBER </li></ul></ul><ul><ul><li>AM & PM </li></ul></ul>
  9. 9. public class java.util.Vector <ul><li>This is an alter native to array, providing various supportive methods. </li></ul><ul><li>Public Constructor </li></ul><ul><ul><li>Vector(); </li></ul></ul><ul><li>Public Methods </li></ul><ul><ul><li>int capacity(); </li></ul></ul><ul><ul><li>int size(); </li></ul></ul><ul><ul><li>boolean isEmpty(); </li></ul></ul><ul><ul><li>Boolean contains(Object); </li></ul></ul><ul><ul><li>int indexOf(Object); </li></ul></ul><ul><ul><li>Int indexOf(Object,int); </li></ul></ul><ul><ul><li>int lastIndexOf(Object); </li></ul></ul><ul><ul><li>Object get(int); </li></ul></ul><ul><ul><li>Object firstElement(); </li></ul></ul><ul><ul><li>Object lastElement(); </li></ul></ul><ul><ul><li>void set(int,Object); </li></ul></ul><ul><ul><li>void add(int,Object); </li></ul></ul><ul><ul><li>void remove(int); </li></ul></ul><ul><ul><li>void remove(Object); </li></ul></ul><ul><ul><li>void clear(); </li></ul></ul>
  10. 10. public class java.util.Stack <ul><li>Represent a general stack </li></ul><ul><li>Public Constructor </li></ul><ul><ul><li>Stack(); </li></ul></ul><ul><li>Public Methods </li></ul><ul><ul><li>boolean empty(); </li></ul></ul><ul><ul><li>Object pop(); </li></ul></ul><ul><ul><li>Object peek(); </li></ul></ul><ul><ul><li>int search(Object); </li></ul></ul><ul><ul><li>Object push(Object); </li></ul></ul>

×