钱能《C++程序设计教材》P14

日期数据存在在文件abc.txt中,格式如下面所示,若年,月,日加起来等于15,则收集,然后按日期从小到大的顺序打印出来

 

Sample Input:

 

None.gif03-11-12
None.gif
03-08-12
None.gif
04-08-11
None.gif
02-07-06

Sample Output:

 

None.gif02年07月06日
None.gif03年08月04日
None.gif


1,c++版本

 

None.gif#include <fstream>
None.gif#include 
<iostream>
None.gif#include 
<string>
None.gif#include 
<vector>
None.gif#include 
<algorithm>
None.gif
using namespace std;
None.gif
None.gif
//日期类
None.gif
class Date
ExpandedBlockStart.gifContractedBlock.gif
dot.gif{
InBlock.gif
private:
InBlock.gif    
string year;//
InBlock.gif
    string month;//
InBlock.gif
    string day;//
InBlock.gif
public:
InBlock.gif    Date(
string strYear,string strMonth,string strDay):year(strYear),month(strMonth),day(strDay)
ExpandedSubBlockStart.gifContractedSubBlock.gif    
dot.gif{
ExpandedSubBlockEnd.gif    }

InBlock.gif    
~Date()
ExpandedSubBlockStart.gifContractedSubBlock.gif    
dot.gif{
ExpandedSubBlockEnd.gif    }

InBlock.gif    
string Year()const
ExpandedSubBlockStart.gifContractedSubBlock.gif    
dot.gif{
InBlock.gif        
return year;
ExpandedSubBlockEnd.gif    }

InBlock.gif    
string Month()const
ExpandedSubBlockStart.gifContractedSubBlock.gif    
dot.gif{
InBlock.gif        
return month;
ExpandedSubBlockEnd.gif    }

InBlock.gif    
string Day()const
ExpandedSubBlockStart.gifContractedSubBlock.gif    
dot.gif{
InBlock.gif        
return day;
ExpandedSubBlockEnd.gif    }

ExpandedBlockEnd.gif}
;
None.gif
None.gif
//用于比较日期
None.gif
class LessThan
ExpandedBlockStart.gifContractedBlock.gif
dot.gif{
InBlock.gif
public:
InBlock.gif    
bool operator ()(const Date* date1,const Date* date2)
ExpandedSubBlockStart.gifContractedSubBlock.gif    
dot.gif{
InBlock.gif        
if(date1->Year()<date2->Year())
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
return true;
ExpandedSubBlockEnd.gif        }

InBlock.gif        
else if(date1->Month()<date2->Month())
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
return true;
ExpandedSubBlockEnd.gif        }

InBlock.gif        
else if(date1->Day()<date2->Day())
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
return true;
ExpandedSubBlockEnd.gif        }

InBlock.gif        
else
InBlock.gif            
return false;
ExpandedSubBlockEnd.gif    }

ExpandedBlockEnd.gif}
;
None.gif
None.gif
None.gif
//日期文件
None.gif
class DateContainer
ExpandedBlockStart.gifContractedBlock.gif
dot.gif{
InBlock.gif
private:
InBlock.gif    
static const string fileName;
InBlock.gif    vector
<Date*> m_dates;
InBlock.gif
public:
InBlock.gif    DateContainer()
ExpandedSubBlockStart.gifContractedSubBlock.gif    
dot.gif{
ExpandedSubBlockEnd.gif    }

InBlock.gif    
~DateContainer()
ExpandedSubBlockStart.gifContractedSubBlock.gif    
dot.gif{
InBlock.gif        vector
<Date*>::iterator iter;
InBlock.gif        
for(iter=m_dates.begin();iter!=m_dates.end();++iter)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            delete (
*iter);
ExpandedSubBlockEnd.gif        }

InBlock.gif        m_dates.clear();
ExpandedSubBlockEnd.gif    }

InBlock.gif
InBlock.gif    
bool ProcessDate()
ExpandedSubBlockStart.gifContractedSubBlock.gif    
dot.gif{//读数据
InBlock.gif
        ifstream infile(DateContainer::fileName.c_str());
InBlock.gif        
if(!infile)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
return false;
ExpandedSubBlockEnd.gif        }

InBlock.gif        
string tmpLine;
InBlock.gif        
while(infile>>tmpLine)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
//读一行数据
InBlock.gif
            int firstPos = tmpLine.find_first_of('-');//第一个'-'
InBlock.gif
            int lastPos =  tmpLine.find_last_of('-');//第二个'-'
InBlock.gif
            string strOne = tmpLine.substr(0,2);//第一个域
InBlock.gif
            string strTwo = tmpLine.substr(firstPos+1,2);//第二个域
InBlock.gif
            string strThree = tmpLine.substr(lastPos+1,2);//第三个域
InBlock.gif
            int year,month,day;
InBlock.gif            year 
= ProcessField(strOne);
InBlock.gif            month 
= ProcessField(strTwo);
InBlock.gif            day 
= ProcessField(strThree);
InBlock.gif            
if(IsValidRecord(year,month,day))
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{//符合要求,保存此记录
InBlock.gif
                Date* date = new Date(strOne,strTwo,strThree);
InBlock.gif                m_dates.push_back(date);
ExpandedSubBlockEnd.gif            }

ExpandedSubBlockEnd.gif        }

InBlock.gif        sort(m_dates.begin(),m_dates.end(),LessThan());
//排序
InBlock.gif
        printDates();
InBlock.gif        
return true;
ExpandedSubBlockEnd.gif    }

InBlock.gif
InBlock.gif    
int ProcessField(string& field)
ExpandedSubBlockStart.gifContractedSubBlock.gif    
dot.gif{//处理各个域
InBlock.gif
        if(field[0]=='0')
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
return field[1]-'0';
ExpandedSubBlockEnd.gif        }

InBlock.gif        
else
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
return (field[0]-'0')*10+(field[1]-'0');
ExpandedSubBlockEnd.gif        }

ExpandedSubBlockEnd.gif    }

InBlock.gif    
bool IsValidRecord(int first,int second ,int third)
ExpandedSubBlockStart.gifContractedSubBlock.gif    
dot.gif{//是否合法记录
InBlock.gif
        return (first+second+third)==15;
ExpandedSubBlockEnd.gif    }

InBlock.gif    
void printDates()
ExpandedSubBlockStart.gifContractedSubBlock.gif    
dot.gif{//遍历输出
InBlock.gif
        vector<Date*>::iterator iter;
InBlock.gif        
for(iter=m_dates.begin();iter!=m_dates.end();++iter)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            cout
<<(*iter)->Year()<<""<<(*iter)->Month()<<""<<(*iter)->Day()<<""<<endl;
ExpandedSubBlockEnd.gif        }

ExpandedSubBlockEnd.gif    }

InBlock.gif
ExpandedBlockEnd.gif}
;
None.gif
None.gif
const string DateContainer::fileName = "D:\\abc.txt";//数据文件
None.gif

None.gif
int main()
ExpandedBlockStart.gifContractedBlock.gif
dot.gif{
InBlock.gif    DateContainer container;
InBlock.gif    
//读取数据
InBlock.gif
    if(!container.ProcessDate())
ExpandedSubBlockStart.gifContractedSubBlock.gif    
dot.gif{
InBlock.gif        cout
<<"error"<<endl;
InBlock.gif        
return -1;
ExpandedSubBlockEnd.gif    }

InBlock.gif    system(
"pause");
InBlock.gif    
return 0;
ExpandedBlockEnd.gif}

None.gif

2C#版:

None.gif
None.gif
using System;
None.gif
using System.Collections.Generic;
None.gif
using System.Text;
None.gif
using System.Collections;
None.gif
using System.IO;
None.gif
None.gif
namespace ConsoleApplication1
ExpandedBlockStart.gifContractedBlock.gif
dot.gif{
InBlock.gif    
//日期类
InBlock.gif
    class Date : IComparable 
ExpandedSubBlockStart.gifContractedSubBlock.gif    
dot.gif{
InBlock.gif        
private String year;//
InBlock.gif
        private String month;//
InBlock.gif
        private String day;//
InBlock.gif
        public Date(String strYear,String strMonth,String strDay)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
this.year = strYear;
InBlock.gif            
this.month = strMonth;
InBlock.gif            
this.day = strDay;
ExpandedSubBlockEnd.gif        }

InBlock.gif
InBlock.gif        
public String Year
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
get
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
return year;
ExpandedSubBlockEnd.gif            }

ExpandedSubBlockEnd.gif        }

InBlock.gif        
public String Month
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
get
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
return month;
ExpandedSubBlockEnd.gif            }

ExpandedSubBlockEnd.gif        }

InBlock.gif        
public String Day
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
get
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
return day;
ExpandedSubBlockEnd.gif            }

ExpandedSubBlockEnd.gif        }

InBlock.gif        
public int CompareTo(object obj)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
if (obj is Date)
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                Date otherDate 
= (Date)obj;
InBlock.gif                
if (this.Year != otherDate.Year)
ExpandedSubBlockStart.gifContractedSubBlock.gif                
dot.gif{
InBlock.gif                    
return this.Year.CompareTo(otherDate.Year);
ExpandedSubBlockEnd.gif                }

InBlock.gif                
else if (this.Month != otherDate.Month)
ExpandedSubBlockStart.gifContractedSubBlock.gif                
dot.gif{
InBlock.gif                    
return this.Month.CompareTo(otherDate.Month);
ExpandedSubBlockEnd.gif                }

InBlock.gif                
else if (this.Day != otherDate.Day)
ExpandedSubBlockStart.gifContractedSubBlock.gif                
dot.gif{
InBlock.gif                    
return this.Day.CompareTo(otherDate.Day);
ExpandedSubBlockEnd.gif                }

InBlock.gif                
else
InBlock.gif                    
return 0;
ExpandedSubBlockEnd.gif            }

InBlock.gif            
else
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
throw new ArgumentException("object is not a Date");
ExpandedSubBlockEnd.gif            }
    
InBlock.gif
ExpandedSubBlockEnd.gif        }

ExpandedSubBlockEnd.gif    }

InBlock.gif
InBlock.gif        
//日期文件
InBlock.gif
    class DateContainer
ExpandedSubBlockStart.gifContractedSubBlock.gif    
dot.gif{
InBlock.gif        
private const String fileName = "D:\\abc.txt";
InBlock.gif        
private ArrayList m_dates = new ArrayList();
InBlock.gif        
public DateContainer()
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
ExpandedSubBlockEnd.gif        }

InBlock.gif        
public bool ProcessDate()
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{//读数据
InBlock.gif

InBlock.gif            StreamReader din 
= File.OpenText(fileName);
InBlock.gif            String tmpLine;
InBlock.gif
InBlock.gif            
while ((tmpLine = din.ReadLine()) != null
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
//读一行数据
InBlock.gif
                int firstPos = tmpLine.IndexOf('-');//第一个'-'
InBlock.gif
                int lastPos = tmpLine.LastIndexOf('-');//第二个'-'
InBlock.gif
                String strOne = tmpLine.Substring(02);//第一个域
InBlock.gif
                String strTwo = tmpLine.Substring(firstPos + 12);//第二个域
InBlock.gif
                String strThree = tmpLine.Substring(lastPos + 12);//第三个域
InBlock.gif
                int year, month, day;
InBlock.gif                year 
= ProcessField(strOne);
InBlock.gif                month 
= ProcessField(strTwo);
InBlock.gif                day 
= ProcessField(strThree);
InBlock.gif                
if (IsValidRecord(year, month, day))
ExpandedSubBlockStart.gifContractedSubBlock.gif                
dot.gif{//符合要求,保存此记录
InBlock.gif
                    Date date = new Date(strOne, strTwo, strThree);
InBlock.gif                    m_dates.Add(date);
ExpandedSubBlockEnd.gif                }

ExpandedSubBlockEnd.gif            }

InBlock.gif
InBlock.gif            m_dates.Sort();
InBlock.gif            printDates();
InBlock.gif            
return true;
ExpandedSubBlockEnd.gif        }

InBlock.gif
InBlock.gif        
public int ProcessField(String field)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{//处理各个域
InBlock.gif
            if(field[0]=='0')
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
return field[1]-'0';
ExpandedSubBlockEnd.gif            }

InBlock.gif            
else
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
return (field[0]-'0')*10+(field[1]-'0');
ExpandedSubBlockEnd.gif            }

ExpandedSubBlockEnd.gif        }

InBlock.gif        
public bool IsValidRecord(int first,int second ,int third)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{//是否合法记录
InBlock.gif
            return (first+second+third)==15;
ExpandedSubBlockEnd.gif        }

InBlock.gif        
public void printDates()
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{//遍历输出
InBlock.gif
            foreach (Date date in m_dates)
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                System.Console.WriteLine(
"{0}年{1}月{2}日", date.Year, date.Month, date.Day);
ExpandedSubBlockEnd.gif            }

ExpandedSubBlockEnd.gif        }

InBlock.gif
ExpandedSubBlockEnd.gif    }

InBlock.gif    
class Program
ExpandedSubBlockStart.gifContractedSubBlock.gif    
dot.gif{
InBlock.gif        
static void Main(string[] args)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            DateContainer container 
= new DateContainer();
InBlock.gif            container.ProcessDate();
ExpandedSubBlockEnd.gif        }

ExpandedSubBlockEnd.gif    }

ExpandedBlockEnd.gif}

None.gif
None.gif

3java:

None.gif
None.gif
None.gif
import java.util.ArrayList;
None.gif
import java.util.Collections;
None.gif
import java.util.Comparator;
None.gif
import java.io.BufferedReader;
None.gif
import java.io.FileReader;
None.gif
import java.io.FileNotFoundException;
None.gif
import java.io.IOException;
None.gif
None.gif
None.gif
//日期类
None.gif
class MyDate
ExpandedBlockStart.gifContractedBlock.gif
dot.gif{
InBlock.gif    
private String year;//
InBlock.gif
    private String month;//
InBlock.gif
    private String day;//
InBlock.gif
    public MyDate(String strYear,String strMonth,String strDay)
ExpandedSubBlockStart.gifContractedSubBlock.gif    
dot.gif{
InBlock.gif        
this.year = strYear;
InBlock.gif        
this.month = strMonth;
InBlock.gif        
this.day = strDay;
ExpandedSubBlockEnd.gif    }

ExpandedSubBlockStart.gifContractedSubBlock.gif    
public String getDay() dot.gif{
InBlock.gif        
return day;
ExpandedSubBlockEnd.gif    }

ExpandedSubBlockStart.gifContractedSubBlock.gif    
public String getMonth() dot.gif{
InBlock.gif        
return month;
ExpandedSubBlockEnd.gif    }

ExpandedSubBlockStart.gifContractedSubBlock.gif    
public String getYear() dot.gif{
InBlock.gif        
return year;
ExpandedSubBlockEnd.gif    }

ExpandedBlockEnd.gif}

None.gif
//    用于比较日期
None.gif
class LessThan implements Comparator
ExpandedBlockStart.gifContractedBlock.gif
dot.gif{
InBlock.gif    
public int compare(Object o1, Object o2) 
ExpandedSubBlockStart.gifContractedSubBlock.gif    
dot.gif{
InBlock.gif        MyDate date1 
= (MyDate)o1;
InBlock.gif        MyDate date2 
= (MyDate)o2;
InBlock.gif        
if(date1.getYear()!=date2.getYear())
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
return date1.getYear().compareTo(date2.getYear());
ExpandedSubBlockEnd.gif        }

InBlock.gif        
else if (date1.getMonth() != date2.getMonth())
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
return date1.getMonth().compareTo(date2.getMonth());
ExpandedSubBlockEnd.gif        }

InBlock.gif        
else if (date1.getDay() != date2.getDay())
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
return date1.getDay().compareTo(date2.getDay());
ExpandedSubBlockEnd.gif        }

InBlock.gif        
else
InBlock.gif            
return 0;
ExpandedSubBlockEnd.gif    }

InBlock.gif
ExpandedBlockEnd.gif}

None.gif
None.gif
//日期文件
None.gif
class DateContainer
ExpandedBlockStart.gifContractedBlock.gif
dot.gif{
InBlock.gif    
private final String fileName = "D:\\abc.txt";
InBlock.gif    
private ArrayList<MyDate> m_dates = new ArrayList();
InBlock.gif
InBlock.gif    
public DateContainer()
ExpandedSubBlockStart.gifContractedSubBlock.gif    
dot.gif{
ExpandedSubBlockEnd.gif    }

InBlock.gif    @SuppressWarnings(
"unchecked")
InBlock.gif    
public boolean ProcessDate()
ExpandedSubBlockStart.gifContractedSubBlock.gif    
dot.gif{//读数据
InBlock.gif

InBlock.gif        FileReader fr 
= null;
InBlock.gif        BufferedReader br 
= null;
InBlock.gif        StringBuffer sBuffer 
= new StringBuffer();
InBlock.gif         
try
ExpandedSubBlockStart.gifContractedSubBlock.gif         
dot.gif{
InBlock.gif             
try
ExpandedSubBlockStart.gifContractedSubBlock.gif             
dot.gif{
InBlock.gif                 fr 
= new FileReader(fileName);// 建立FileReader对象,并实例化为fr
ExpandedSubBlockEnd.gif
             }

InBlock.gif             
catch (FileNotFoundException e)
ExpandedSubBlockStart.gifContractedSubBlock.gif             
dot.gif{
InBlock.gif                 e.printStackTrace();
ExpandedSubBlockEnd.gif             }

InBlock.gif             br 
= new BufferedReader(fr);// 建立BufferedReader对象,并实例化为br
InBlock.gif
                 
InBlock.gif             String tmpLine 
= br.readLine();// 从文件读取一行字符串
InBlock.gif             
// 判断读取到的字符串是否不为空
InBlock.gif
             while (tmpLine != null)
ExpandedSubBlockStart.gifContractedSubBlock.gif             
dot.gif{
InBlock.gif                 
int firstPos = tmpLine.indexOf('-');//第一个'-'
InBlock.gif
                 int lastPos = tmpLine.lastIndexOf('-');//第二个'-'
InBlock.gif
                 String strOne = tmpLine.substring(02);//第一个域
InBlock.gif
                 String strTwo = tmpLine.substring(firstPos + 1, lastPos);//第二个域
InBlock.gif
                 String strThree = tmpLine.substring(lastPos + 1, tmpLine.length());//第三个域
InBlock.gif
                 int year, month, day;
InBlock.gif                 year 
= ProcessField(strOne);
InBlock.gif                 month 
= ProcessField(strTwo);
InBlock.gif                 day 
= ProcessField(strThree);
InBlock.gif                 
if (IsValidRecord(year, month, day))
ExpandedSubBlockStart.gifContractedSubBlock.gif                 
dot.gif{//符合要求,保存此记录
InBlock.gif
                     MyDate date = new MyDate(strOne, strTwo, strThree);
InBlock.gif                     m_dates.add(date);
ExpandedSubBlockEnd.gif                 }

InBlock.gif                 tmpLine 
= br.readLine();// 从文件中继续读取一行数据
ExpandedSubBlockEnd.gif
             }

ExpandedSubBlockEnd.gif         }

InBlock.gif         
catch (IOException e)
ExpandedSubBlockStart.gifContractedSubBlock.gif         
dot.gif{
InBlock.gif             e.printStackTrace();
ExpandedSubBlockEnd.gif         }

InBlock.gif         
finally
ExpandedSubBlockStart.gifContractedSubBlock.gif         
dot.gif{
InBlock.gif             
try
ExpandedSubBlockStart.gifContractedSubBlock.gif             
dot.gif{
InBlock.gif                 
if (br != null)
InBlock.gif                     br.close();
// 关闭BufferedReader对象
InBlock.gif
                 if (fr != null)
InBlock.gif                     fr.close();
// 关闭文件
ExpandedSubBlockEnd.gif
             }

InBlock.gif             
catch (IOException e)
ExpandedSubBlockStart.gifContractedSubBlock.gif             
dot.gif{
InBlock.gif                 e.printStackTrace();
ExpandedSubBlockEnd.gif             }

ExpandedSubBlockEnd.gif         }

InBlock.gif         Comparator comp 
= new LessThan();
InBlock.gif         Collections.sort(m_dates, comp);
InBlock.gif         printDates();
InBlock.gif        
return true;
ExpandedSubBlockEnd.gif    }

InBlock.gif
InBlock.gif    
public int ProcessField(String field)
ExpandedSubBlockStart.gifContractedSubBlock.gif    
dot.gif{//处理各个域
InBlock.gif
        if(field.charAt(0)=='0')
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
return field.charAt(1)-'0';
ExpandedSubBlockEnd.gif        }

InBlock.gif        
else
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
return (field.charAt(0)-'0')*10+(field.charAt(1)-'0');
ExpandedSubBlockEnd.gif        }

ExpandedSubBlockEnd.gif    }

InBlock.gif    
public boolean IsValidRecord(int first,int second ,int third)
ExpandedSubBlockStart.gifContractedSubBlock.gif    
dot.gif{//是否合法记录
InBlock.gif
        return (first+second+third)==15;
ExpandedSubBlockEnd.gif    }

InBlock.gif    
public void printDates()
ExpandedSubBlockStart.gifContractedSubBlock.gif    
dot.gif{//遍历输出
InBlock.gif
        for (MyDate date :m_dates)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif           System.out.println(date.getYear()
+""+ date.getMonth()+""+ date.getDay()+"");
ExpandedSubBlockEnd.gif        }

ExpandedSubBlockEnd.gif    }

InBlock.gif
ExpandedBlockEnd.gif}

None.gif
None.gif
public class DateDemo 
ExpandedBlockStart.gifContractedBlock.gif
dot.gif{
InBlock.gif    
public static void main(String[] args) throws IOException
ExpandedSubBlockStart.gifContractedSubBlock.gif    
dot.gif{
InBlock.gif        
// TODO Auto-generated method stub
InBlock.gif
        DateContainer container = new DateContainer();
InBlock.gif        container.ProcessDate();
InBlock.gif        System.in.read();
InBlock.gif
ExpandedSubBlockEnd.gif    }

InBlock.gif
ExpandedBlockEnd.gif}

None.gif
None.gif