soso ce
explain this method
0 Answer(s)      4 years and 5 months ago
Posted in : Java Beginners
i hope any one can explain this method ` private void showMonth(int m, int y) {
        int lead_spaces = 0; 
          if (m < 0 || m > 11) {
        System.out.println("It should be 1 to 12"); 
            } 
         else { 
             System.out.println(); 
             System.out.println("    " + months[m] + " " + y); 
             System.out.println();
             GregorianCalendar cal = new GregorianCalendar(y, m, 0);
             System.out.println("Su Mo Tu We Th Fr Sa "); 
             lead spaces = cal.get(Calendar.DAY OF_WEEK); 
             int day of month = days[m]; 
             if (cal.isLeapYear(cal.get(Calendar.YEAR)) && m == 1){ day of month++;} 
             for (int i = 0; i < lead_spaces; i++) { 
                 System.out.print("   "); 
                  }  

    for (int i = 1; i <= day_of_month; i++) {  
            if (i < 10) System.out.print(" ");  
              System.out.print(i);  
            if ((lead_spaces  + i) % 7 == 0) {  
               System.out.println();  
                 }   
               else {
               System.out.print(" ");  
            }  } 
         System.out.println();   }  }  



  private static void doSimpleDateFormat() {  
    Calendar now = Calendar.getInstance();  
    SimpleDateFormat formatter = new SimpleDateFormat("E yyyy.MM.dd 'at' hh:mm:ss a zzz");  
    System.out.print(" \n It is now : " + formatter.format(now.getTime()));  
     System.out.println();  
          }  


    public static void main(String[] args) {  
        String mo = JOptionPane.showInputDialog("Month");  
        String ye = JOptionPane.showInputDialog("Year");  
        int mon = new Integer(mo).intValue();  
        int yea = new Integer(ye).intValue();  
          EnglishCalendar k = new EnglishCalendar();  
              k.showMonth(mon - 1 , yea);  
         doSimpleDateFormat();

} 

plz help me
Advertisement
View Answers









Related Tutorials/Questions & Answers:
explain this method
explain this method   i hope any one can explain this method ` private void showMonth(int m, int y) { int lead_spaces = 0; if (m < 0 || m > 11) { System.out.println("It should be 1 to 12
Explain - LDAP
Explain LDAP  Any one explain about LDAP ? and also explain about JNDI what relation b/w this two
Advertisements
Explain ServletContext.
Explain ServletContext.  Explain ServletContext.   Hi, Here is the answer, ServletContext interface is a window for a servlet to view it?s environment. A servlet can use this interface to get information
Explain WML
Explain WML  hii, What is WML?   hello, WML stands for Wireless Markup Language. It is a simple language used to create applications for small wireless devices like mobile phones. WML is analogous to HTML
method
method   how and where, we can define methods ? can u explain me with full programme and using comments
Explain unescape() and escape() in JavaScript?
Explain unescape() and escape() in JavaScript?  Explain unescape() and escape() in JavaScript
Explain normalization concept?
Explain normalization concept?  Explain normalization concept
please explain this prog
please explain this prog  can u explain this import java.io.... InputStreamReader(System.in) allows the user to input string on the console. The method.... And using println() method displayed the entered value on the console. Hope
Explain factories design?
Explain factories design?  Hi, I can't understand the concept of factories design, if you can explain it to me in simple words, i would be grateful. Thanks..   Hello, Factory Method is a creational pattern
Explain types of java programs
Explain types of java programs  Explain types of java programs   Types of Java Programs: Standalone Applications Web Applications Enterprise Applications Console Application Web services
please explain this program
please explain this program  public class MainClass { public static void main(String[] args) { System.out.println("Java
Explain Transparent Persistence - Hibernate
Explain Transparent Persistence   Hi Friends, Can u plz explain Transparent Persistence briefly  Hi Follow this link to find solution of your problem... http://www.roseindia.net/jdotutorials/jdo
Explain struts.jar file - Struts
Explain struts.jar file   Hi friends am new to java. I read jar file means collection of java files. For executing struts application what are the necessary jar files. " struts.jar " file contains what. can u explain
Explain push and pop
Explain push and pop   hii, Define push and pop?   hello, The insertion operation is referred to as push and the deletion operation is referred to as pop
please explain this prog
please explain this prog  import java.io.*; class Studar{ public.... The InputStreamReader(System.in) allow the user to input and the method readLine.... The method Integer.parseInt(br.readLine()), reads the marks of each subject
Please explain Hibernate Sessionfactory.
Please explain Hibernate Sessionfactory.  Hi there, Please explain Hibernate session factory in detail. I have just started learning hibernate so i..., the tutorials here will help you learn Hibernate and will explain about hibernate
what is the meaning of this or explain this
what is the meaning of this or explain this  List<Object[]> list=query.list();   Hi Friend, It will return the query values in the form of list. For more information, visit the following link: Hibernate
Explain Hibernate Relationships with example.
Explain Hibernate Relationships with example.  Hello, Please explain various hibernate relationships. And if you can provide some examples that would be a great help.. Thank you....   Hi, Hibernate relational
Please explain @interface with an example
Please explain @interface with an example  Here is the code snippet: @Retention(RUNTIME) @Target({ FIELD }) public @interface InjectProperty... explain what does all these mean? How all these work
Please explain @interface with an example
Please explain @interface with an example  Here is the code snippet: @Retention(RUNTIME) @Target({ FIELD }) public @interface InjectProperty... runnable; where Runnable is an interface. Could you please explain what does
explain servletconfig with programiing example?
explain servletconfig with programiing example?  explain servletconfig with programiing example?   ServletConfig is a servlet configuration object used by a servlet container used to pass information to a servlet during
Explain Linked List
Explain Linked List   hello, What is Linked List ?   hello, Linked List is one of the fundamental data structures. It consists of a sequence of nodes, each containing arbitrary data fields pointing to the next
can any one explain this
can any one explain this  class Clidder { private final void flipper() { System.out.println("Clidder"); } } public class Ex3 extends Clidder { public final void flipper() { System.out.println
method
method  can you tell me how to write an abstract method called ucapan() for B2 class class A2{ void hello(){ system.out.println("hello from A2"); }} class B2 extends A2{ void hello(){ system.out.println("hello from B2
can you explain ?
can you explain ?  my dear can you teel me the explaintion for this code i need it GregorianCalendar cal = new GregorianCalendar(y, m, 0...(); } } iam explain whole code exept this part can you help
java explain - Java Beginners
of diagram (heap and stak) also explain how the code arrived at the results in b, b1
Please explain the logic....
Please explain the logic....  class A1 { } class B extends A1 { } public class ComingThru { static String s = "-"; public static void main(String[] args) { A1[] aa = new A1[2]; B[] ba = new B[2
program on helloworld :explain
a new class "Hello". The main Method: The main method is the entry point in the Java program and java program can't run without main method. JVM calls the main method of the class. This method is always first thing that is executed
program on helloworld :explain
". The main Method: The main method is the entry point in the Java program and java program can't run without main method. JVM calls the main method of the class. This method is always first thing that is executed in a java program. Here
Explain the persistence class in hibernate?
Explain the persistence class in hibernate?  What is persistence class in hibernate?   Persistence class are simple POJO classes in an application. It works as implementation of the business application for example
Explain the concept of thread priorities in Java.
Explain the concept of thread priorities in Java.  Explain the concept of thread priorities in Java