Java Code with Highlight

Java Code with Highlight

from: javanotes3/source/Interest1Console. java

show the code :

/* Simulation of console-I/O program Interest1,
   using Console Applet as a basis.  See the file
   Console Applet. java for more information.
   David Eck

public class Interest1Console extends Console Applet {

   protected String getTitle() {
      return "Sample program \"Interest1\"";

   protected void program() {

        Program  computes the amount of interest that is
        earned on $17,000 invested at an interest
        rate of 0.07 for one year.  The interest and
        the value of the investment after one year are
        printed to standard output.

      double principal;     // The value of the investment.
      double rate;          // The annual interest rate.
      double interest;      // Interest earned in one year.
      /* Do the computations. */
      principal = 17000;
      rate = 0.07;
      interest = principal * rate;   // Compute the interest.
      principal = principal + interest;
      // Compute value of investment after one year, with interest.
      // (Note: The new value replaces the old value of principal.)
      /* Output the results. */
      console.put("The interest earned is $");
      console.put("The value of the investment after one year is $");



public class DateUtil {

 * 只比较日期,不比较小时,分钟,秒
 * @param date1
 * @param date2
 * @return date1  date2 返回 1
 public static int compareOnlyDate(Date date1, Date date2) {
 Calendar cal1 = Calendar.getInstance();
 cal1.set(Calendar.HOUR_OF_DAY, 0);
 cal1.set(Calendar.MINUTE, 0);
 cal1.set(Calendar.SECOND, 0);
 cal1.set(Calendar.MILLISECOND, 0);
 Calendar cal2 = Calendar.getInstance();
 cal2.set(Calendar.HOUR_OF_DAY, 0);
 cal2.set(Calendar.MINUTE, 0);
 cal2.set(Calendar.SECOND, 0);
 cal2.set(Calendar.MILLISECOND, 0);
 return cal1.compareTo(cal2);
好烂啊有点差凑合看看还不错很精彩 (No Ratings Yet)

6 thoughts on “Java Code with Highlight

  1. Do you mind if I quote a couple of your posts as long as I provide credit and sources back to your website? My blog is in the exact same area of interest as yours and my visitors would genuinely benefit from a lot of the information you provide here. Please let me know if this okay with you. Thanks!

  2. I just couldn’t depart your website prior to suggesting that I extremely enjoyed the standard information a person provide for your visitors? Is gonna be back often to check up on new posts

  3. Neat blog! Is your theme custom made or did you download it from somewhere? A theme like yours with a few simple adjustements would really make my blog jump out. Please let me know where you got your design. Cheers

  4. Great write-up, I am regular visitor of one’s blog, maintain up the nice operate, and It’s going to be a regular visitor for a lengthy time.

  5. Thanks a lot for providing individuals with a very marvellous opportunity to read articles and blog posts from this site. It’s usually very fantastic plus full of fun for me personally and my office co-workers to search your site at minimum three times weekly to read through the latest items you have got. And of course, I am also at all times amazed with your exceptional opinions you give. Some 3 points on this page are without a doubt the most impressive I’ve had.


电子邮件地址不会被公开。 必填项已用*标注