Trying to print the date arrays in reverse order....

Hi,
I'm trying to print the dates in the arrays in reverse order using the for loop, but its not working and i think ive got something in the wrong order perhaps the constructor or method. Or do i need to define 'a', because i tried it and i couldn't unless, probably because i was putting the wrong code for it.
Thanks for your help
public class Array
  public static void main(String[] args)
          a[0] = new Date(2, " January ", 2005)
          a[1] = new Date(3, " February ", 2005)
          a[2] = new Date(21, " March ", 2005)
          a[3] = new Date(28, " April ", 2005)
                               printDate();
class Date
  public int day;
  public String month;
  public int year;
  public Date(int d, String m, int y)
    day = d;
    month = m;
    year = y;
  public void printDate()
  for (int i = a.length - 1; i >= 0; i--)
              System.out.println(a);

I don't see where this 'a' variable is declared anywhere, so what did you expect it to do? Also, you can't just call Date's printDate method from your Array class like that. You really need to start with the java tutorials or take a course. The forums aren't going to effectively teach you the very basics.

Similar Messages

  • Printing the date in PSE8

    I am trying to print the date on my photos in PSE8.  I have checked the box in the "More options" sections of the print box, but the date is not printing.  How can I get this to work?

    Please attach the screenshot of the settings you are doing on main print dialog and More options dialog box. In case you are using scaled to fit media, then this will not work.
    Also in case u can try printing other image and check if the issue is with this image or application
    -garry

  • How can I get the data array from SQL Server Database?

    Hi,
    I can write a data array(2D)into a table of my SQL Server Database. The data array was writen to a column with image type. I know a data array is transformed a binary string when writing into database, but I dont know how to get the data array when I fetch the binary string from database.
    My question is:
    How to transform the binary string into data array? which vi's should I use? I have tried unflatten from string but failed.
    Any response is appriciated.
    Red

    happyxh0518 wrote:
    > I can write a data array(2D)into a table of my SQL Server Database.
    > The data array was writen to a column with image type. I know a data
    > array is transformed a binary string when writing into database, but I
    > dont know how to get the data array when I fetch the binary string
    > from database.
    >
    > My question is:
    > How to transform the binary string into data array? which vi's should
    > I use? I have tried unflatten from string but failed.
    In order to use Unflatten from string you first need to Flatten it
    before writing it. Also depending on the database driver, the returned
    data may actually not be binary but Hexadecimal encoded ASCII which you
    would first have to decode to binray.
    Rolf Kalbermatter
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • How to print the data in the grid?

    Hi all,
    I'm new to java. So, I need some helps.
    I want to print the data in the grid. Data could be more than one page. But I have no idea how to start writing code.
    Please let me know if you know.
    Thank you.
    DT.

    Follow this steps.
    1- the Grid which you wish to print must locate in a class which implements Printable() interface.
    e.g.
    import javax.swing.table.*;
    import java.awt.print.*;
    import javax.infobus.*;
    public class myGridControl extends GridControl implements Printable{
    // add the following statements in the definition section of your class
    int m_maxNumPage =1;
    JTable m_table;
    TableModel m_tableModel;
    ScrollableRowsetAccess myRs;
    // add the folowing statemnts in the
    //constructor or init method or start method
    //(Notice:if you couldn't print, possible
    //you didn't put these stetment on the right
    //location and one or all of them
    //are "null".change the location and make
    //sure they are not null when you issue a
    //print order)
    m_table = new JTable();
    m_table = masterGrid.getTable();
    m_tableModel = m_table.getModel();
    myRs = (ScrollableRowsetAccess)masterGrid.getDataItem();
    3- add following methods to your class(myGridControl). just cut and paste.
    // Print Methods
    public void printData() {
    try {
    PrinterJob prnJob = PrinterJob.getPrinterJob();
    prnJob.setPrintable(this);
    if (!prnJob.printDialog())
    return;
    prnJob.print();
    catch (PrinterException e) {
    e.printStackTrace();
    System.err.println("Printing error: "+e.toString());
    public int print(Graphics pg, PageFormat pageFormat,int pageIndex) throws PrinterException {
    JLabel m_title=new JLabel("Alexus Report : "+titleName);
    if (pageIndex >= m_maxNumPage)
    return NO_SUCH_PAGE;
    pg.translate((int)pageFormat.getImageableX(),
    (int)pageFormat.getImageableY());
    int wPage = 0;
    int hPage = 0;
    if (pageFormat.getOrientation() == pageFormat.PORTRAIT) {
    wPage = (int)pageFormat.getImageableWidth();
    hPage = (int)pageFormat.getImageableHeight();
    else {
    wPage = (int)pageFormat.getImageableWidth();
    wPage += wPage/2;
    hPage = (int)pageFormat.getImageableHeight();
    pg.setClip(0,0,wPage,hPage);
    int y = 0;
    pg.setFont(m_title.getFont());
    pg.setColor(Color.black);
    Font fn = pg.getFont();
    FontMetrics fm = pg.getFontMetrics();
    y += fm.getAscent();
    pg.drawString(m_title.getText(), 0, y);
    y += 20; // space between title and table headers
    Font headerFont = m_table.getFont().deriveFont(Font.BOLD);
    pg.setFont(headerFont);
    fm = pg.getFontMetrics();
    TableColumnModel colModel = m_table.getColumnModel();
    int nColumns = colModel.getColumnCount();
    int x[] = new int[nColumns];
    x[0] = 0;
    int h = fm.getAscent();
    y += h; // add ascent of header font because of baseline
    // positioning (see figure 2.10)
    int nRow, nCol;
    for (nCol=0; nCol<nColumns; nCol++) {
    TableColumn tk = colModel.getColumn(nCol);
    int width = tk.getWidth();
    if (x[nCol] + width > wPage) {
    nColumns = nCol;
    break;
    if (nCol+1<nColumns)
    x[nCol+1] = x[nCol] + width;
    String title = (String)tk.getIdentifier();
    pg.drawString(title, x[nCol], y);
    pg.setFont(m_table.getFont());
    fm = pg.getFontMetrics();
    int header = y;
    h = fm.getHeight();
    int rowH = Math.max((int)(h*1.5), 10);
    int rowPerPage = (hPage-header)/rowH;
    m_maxNumPage = Math.max((int)Math.ceil(m_table.getRowCount()/
    (double)rowPerPage), 1);
    int iniRow = pageIndex*rowPerPage;
    int endRow = Math.min(m_table.getRowCount(),
    iniRow+rowPerPage);
    // take an array to store columns header
    String colNames[] = new String[nColumns];
    for (nCol=0; nCol<nColumns; nCol++) {
    colNames[nCol] = myRs.getColumnName(nCol+1).toString();
    try{
    for (nRow=iniRow; nRow<endRow; nRow++) {
    y += h;
    // set RowSet on the specific row
    myRs.absolute(nRow+1);
    for (nCol=0; nCol<nColumns; nCol++) {
    /* the next 3 lines are old code
    int col = m_table.getColumnModel().getColumn(nCol).getModelIndex();
    Object obj = m_tableModel.getValueAt(nRow, col);
    String str = obj.toString();
    // take the values column by columns
    ImmediateAccess ia = (ImmediateAccess)myRs.getColumnItem(colNames[nCol]);
    String str = ia.getValueAsString();
    if (str.equals("")) str=" ";
    /* this if is usefull if we'd like to have coloring in printing
    if (obj instanceof ColorData)
    pg.setColor(((ColorData)obj).m_color);
    else
    pg.setColor(Color.black);
    pg.drawString(str, x[nCol], y);
    }catch(Exception e){
    e.printStackTrace();
    System.gc();
    return PAGE_EXISTS;
    public void printData() {
    try {
    PrinterJob prnJob = PrinterJob.getPrinterJob();
    prnJob.setPrintable(this);
    if (!prnJob.printDialog())
    return;
    prnJob.print();
    catch (PrinterException e) {
    e.printStackTrace();
    System.err.println("Printing error: "+e.toString());
    public int print(Graphics pg, PageFormat pageFormat,int pageIndex) throws PrinterException {
    JLabel m_title=new JLabel("Alexus Report : "+titleName);
    if (pageIndex >= m_maxNumPage)
    return NO_SUCH_PAGE;
    pg.translate((int)pageFormat.getImageableX(),
    (int)pageFormat.getImageableY());
    int wPage = 0;
    int hPage = 0;
    if (pageFormat.getOrientation() == pageFormat.PORTRAIT) {
    wPage = (int)pageFormat.getImageableWidth();
    hPage = (int)pageFormat.getImageableHeight();
    else {
    wPage = (int)pageFormat.getImageableWidth();
    wPage += wPage/2;
    hPage = (int)pageFormat.getImageableHeight();
    pg.setClip(0,0,wPage,hPage);
    int y = 0;
    pg.setFont(m_title.getFont());
    pg.setColor(Color.black);
    Font fn = pg.getFont();
    FontMetrics fm = pg.getFontMetrics();
    y += fm.getAscent();
    pg.drawString(m_title.getText(), 0, y);
    y += 20; // space between title and table headers
    Font headerFont = m_table.getFont().deriveFont(Font.BOLD);
    pg.setFont(headerFont);
    fm = pg.getFontMetrics();
    TableColumnModel colModel = m_table.getColumnModel();
    int nColumns = colModel.getColumnCount();
    int x[] = new int[nColumns];
    x[0] = 0;
    int h = fm.getAscent();
    y += h; // add ascent of header font because of baseline
    // positioning (see figure 2.10)
    int nRow, nCol;
    for (nCol=0; nCol<nColumns; nCol++) {
    TableColumn tk = colModel.getColumn(nCol);
    int width = tk.getWidth();
    if (x[nCol] + width > wPage) {
    nColumns = nCol;
    break;
    if (nCol+1<nColumns)
    x[nCol+1] = x[nCol] + width;
    String title = (String)tk.getIdentifier();
    pg.drawString(title, x[nCol], y);
    pg.setFont(m_table.getFont());
    fm = pg.getFontMetrics();
    int header = y;
    h = fm.getHeight();
    int rowH = Math.max((int)(h*1.5), 10);
    int rowPerPage = (hPage-header)/rowH;
    m_maxNumPage = Math.max((int)Math.ceil(m_table.getRowCount()/
    (double)rowPerPage), 1);
    int iniRow = pageIndex*rowPerPage;
    int endRow = Math.min(m_table.getRowCount(),
    iniRow+rowPerPage);
    // take an array to store columns header
    String colNames[] = new String[nColumns];
    for (nCol=0; nCol<nColumns; nCol++) {
    colNames[nCol] = myRs.getColumnName(nCol+1).toString();
    try{
    for (nRow=iniRow; nRow<endRow; nRow++) {
    y += h;
    // set RowSet on the specific row
    myRs.absolute(nRow+1);
    for (nCol=0; nCol<nColumns; nCol++) {
    /* the next 3 lines are old code
    int col = m_table.getColumnModel().getColumn(nCol).getModelIndex();
    Object obj = m_tableModel.getValueAt(nRow, col);
    String str = obj.toString();
    // take the values column by columns
    ImmediateAccess ia = (ImmediateAccess)myRs.getColumnItem(colNames[nCol]);
    String str = ia.getValueAsString();
    if (str.equals("")) str=" ";
    /* this if is usefull if we'd like to have coloring in printing
    if (obj instanceof ColorData)
    pg.setColor(((ColorData)obj).m_color);
    else
    pg.setColor(Color.black);
    pg.drawString(str, x[nCol], y);
    }catch(Exception e){
    e.printStackTrace();
    System.gc();
    return PAGE_EXISTS;
    4- execute printData() method to print.
    e.g. myGridControl.printData();
    let me know if you still cannot print.
    Ali

  • How can I print the DATE in the Header/Footer but NOT the TIME?

    I know how use page set-up to change the headers and footers. Firefox doesn't give me the choice of printing just the DATE rather than the DATE/TIME. I tried Custom Date and it printed "Date", and not the date. I tried &Date and it print the Date & Time.
    Is there a way to print just the date?
    Sign me
    Midnight Printer

    You want to print them on their own? Can't be done. WIth the photo? Install this
    http://www.iborderfx.com/iborderfx/

  • Xsl/Xml - How can I print the date?

    That might sound like a silly question but no matter what I do, I get an error when I try to select or copy the value of fn:current-dateTime(). All I want to do is display the date and time. Is this only available in XSLT 2.0? If so, what could I use in XSLT 1.0 that would allow me to print the date and/or time?
    Thanks,
    tech_isis

    I just discovered that you can call java within an xsl stylesheet. What I need is to capture the "system time" when the stylesheet is processing. So here's a snippet of what I have in my stylesheet:
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:date="java.util.Date" xmlns:format="java.text.SimpleDateFormat" xmlns:cal="java.util.Calendar" xmlns:java="java">
    <xsl:value-of select ="java:util.Date.new()"/>
    gives me a long date i.e. Tue Nov 7....
    what I want is YYYYMMDDHHMMSS
    I've tried formattng this use SimpleDateFormat but with no success.
    Can anyone point me in the right direction?
    Thanks,
    tech_isis

  • I am using Adobe XI Pro and in various parts of the document there is brown / biege lettering when on the document it shows as black.  My printer guy has been in and checked it out top to bottom and that part is fine.  I have tried to print the same docum

    I am using Adobe XI Pro and in various parts of the document there is brown / biege lettering when on the document it shows as black.  My printer guy has been in and checked it out top to bottom and that part is fine.  I have tried to print the same document and it comes out fine.  Any ideas ?   Using Windows 7 Service Pack 1

    Sorry my bad.  I have tried to print the same document on another printer and all the formatting is fine. 

  • How to print the date in Horizontal way in query................

    Hiu2026u2026
    I have created a query using SQVIu2026The output is likeu2026
    Zone | Customer Group | Customer Name | Date | Value(Rs)
    East | ABC/JPR | ABC pvt ltd | 01.08.2011 | 50,000
    West | LMN/Delhi | LMN pvt ltd | 02.08.2011 | 1, 50,000
    South | PQR/Haryana | PQR auto sales p l | 03.08.2011 | 1,00,000
    My problem is i have to print the date in the format like
    Zone | Customer Group | Customer Name | 01.08.2011 | 02.08.2011 | 03.08.11 | 04.08.2011 |..............31.08.2011|
    East | ABC/JPR | ABC pvt ltd | 50000 | 150000 | 100000 | | |
    Thanks&Regards,
    Pranitha.

    Hi Pranita,
    You could try with logic:
    CONCATENATE LINES OF itab INTO warea SEPARATED BY '|'.
    BR
    Dep

  • I am using window.print() to print the data of my webpage, it prints only first page and left the remaining while it works fine with IE and Google Chrome, ie print all the pages.

    My Page has data more than one page, it has verticle scroll bar to view all data .
    I used window.print() to print the data of webpage, but it prints only first page and left the remaining information.
    This works fine with Internet Explorer 6+ and Google Chrome.

    Does the entire webpage appear in Print Preview? <br />
    File > Print Preview

  • Is there any way to print  the data inside  the Notes field of MIR6 Report

    Hello Gurús.
    We need to include the data inside the Notes field in the report MIR6 - INVOICE OVERVIEW - report.
    Is there any way to print  the data inside (comments)  the Notes field as well in the Report  ?
    We found that the only way is to open the Notes and print it, but it takes time, any idea ?
    Rgds.
    MCM.

    There's nothing built-in that does that. If you only have text fields and they don't have any formatting or other property that would prevent it (e.g., Date, character limit), you can run a simple script to populate each field with the field name, and then print. A more complicated approach would be a script that adds text annotations near/over each field that shows the field name. This would just be for documentation purposes, but it's possible. Post again if you'd like help with the first. You'll probably have to pay someone for the second approach if you don't want to do it yourself.

  • How to print the data Dynamically in smartforms

    Hi Experts,
    I need to print the data dynamically in different windows on the same page.For example in the first window 25 records,2nd window 25 records and 3rd window 25 records.I need it dynamically.How to achieve this?

    Hi,
    If you have an internal table which fetches the data... Then you can have table in each window and in the data tab give from row and to row values to display how many records and from where to where you want to display.
    Regards,
    -Sandeep

  • On the initial set up for apple tv it just sits there trying to set the date and time . it is a wireless setup and the ipaddress and router address is correct . I can't get by this screen

    On the initial set up for apple tv it just sits there trying to set the date and time . it is a wireless setup and the ipaddress and router address is correct . I can't get by this screen. The setting is on automatic and I have picked a city in my time zone yet it still tries to set a time and date but fails.
    thanks

    Make sure router is up to date. Try ethernet to rule out any wifi issues. Reboot ATV and router.

  • Error while trying to Lock the data in Essbase

    Hi All,
    I am currently facing a issue in Essbase when I am trying to lock the data it shows me the following error message.
    Error Encountered is : "You do have sufficient access to perform a lock on this database". I have checked with the administrators / support team and according to them there is nothing wrong with my access. I have the write access to the database and I should be able to lock and send the data but they are unable to figure out why my access is not working or i am facing the above issue. They asked me to select update mode in the essbase options and try but even that didn't work. I am able to make the changes on the same data in Hyperion Planning. I want to lock and send the data directly to server. But I am unable to lock the data. Please expedite.
    Thanks a lot for your help in advance.

    From your post, it sounds like the problem is not Update mode since you mentioned you tried turning it on (I do not recommend having it on). It does sound like a security issue. Depending on the version, planning and Essbase can use different IDs for the same perosn (If I remember planning used to create two IDs one for planning and one for Essbase) The Essbase id had less access than the planning id did. I would test this by having a test Essbase ID set up that has write access and see if that ID can write directly to Essbase. If it can, I would look at filters and groups the ID is on to see if there is some sort of conflict. I have sen that message when a user had read access to part of the DB and write access to another part, but they were pulling data from the read access section only

  • How can I print the date and time in a photo from iPhoto

    How can I print the date and time in a photo from iPhoto

    You want to print them on their own? Can't be done. WIth the photo? Install this
    http://www.iborderfx.com/iborderfx/

  • How to print the data  if we take different fields from diffrent tables

    Hi ABAPers,
    I take diff fields from 3 tables. Those are
    these fields from EKBE
           EBELN
           EBELP
           BELNR
           BUZEI
           BWART
           BUDAT
           AREWR
           REEWR
           WERKS
           MWSKZ
    these fields from EKKO
           BUKRS
           BSART
           WAERS
    these field from EKPO
           TXZ01
           MATNR
           MTART
    I want to print the data all fields.What logic can i write?
    Please help me for this question and i am waiting for your response.
    Regards,
    Raja Sekhar.

    Hi,
    First you have to fetch data from all the three tables and then consolidate into final table.
    In Declaration:
    1.Declare Internal Table for EKKO holding:
    EBELN
    BUKRS
    BSART
    WAERS
    2.Declare Internal Table for EKPO holding:
    EBELN
    EBELP
    TXZ01
    MATNR
    MTART
    3.Declare Internal Table for EKBe holding:
    EBELN
    EBELP
    BELNR
    BUZEI
    BWART
    BUDAT
    AREWR
    REEWR
    WERKS
    MWSKZ
    *==> This table has
    MANDT
    EBELN
    EBELP
    ZEKKN
    VGABE
    GJAHR
    BELNR
    BUZEI
    as Primary keys field,you should have values for all the PK aotherwise you will get multiple entries*
    4.Declare a Final Internal Table i_final with all the fields you want
    EBELN
    EBELP
    BUKRS
    BSART
    WAERS
    TXZ01
    MATNR
    MTART
    BELNR
    BUZEI
    BWART
    BUDAT
    AREWR
    REEWR
    WERKS
    MWSKZ
    Data Fetching
    select EBELN
    BUKRS
    BSART
    WAERS
    from EKKO
    into table i_ekko
    where .........<selection criteria>.
    if not i_ekko is initial.
    select EBELN
    EBELP
    TXZ01
    MATNR
    MTART
    from EKPO
    into table i_ekpo
    for all entries in i_ekko
    where EBELN = I_EKKO-EBELN
    AND ......<If any other selection criteria>.
    if not i_ekpo is initial.
    select EBELN
    EBELP
    BELNR
    BUZEI
    BWART
    BUDAT
    AREWR
    REEWR
    WERKS
    MWSKZ
    from EKBE
    into table i_ekbe
    for all entries in i_ekpo
    where ebeln = i_ekpo-ebeln
    and ebelp = i_ekpo-ebelp
    and ..........<If any othet selection criteria>
    endif.
    endif.
    Consolidate
    sort i_ekko by ebeln.
    sort i_ekpo by ebeln ebelp.
    sort i_ekbe by ebeln ebelp.
    LOOP AT i_ekbe into wa_ekbe.
    read table i_ekko into wa_ekko with key ebeln = wa_ekbe-vbeln binary search.
    if sy-subrc = 0.
    ====>Move all the required firlds from I_EKKO to i_final  , like
    wa_final-BUKRS = wa_ekko-BUKRS.
    endif.
    read table i_ekpo into wa_ekpo with key ebeln = wa_ekbe-vbeln
    ebelp = wa_ekbe-ebelp binary search.
    if sy-subrc = 0.
    ====>Move all the required firlds from I_EKPO to i_final  , like
    wa_final-EBELP = wa_ekko-EBELP.
    wa_final-TXZ01 = wa_ekko-TXZ01.
    endif.
    ==>Also all the required fields from EKBE to final table, like
    wa_final-BELNR = wa_ekbe-BELNR.
    endloop.

Maybe you are looking for

  • Save as PDF not showing all records?

    BOXI31 SP3 Users are saving as PDF, no errors,  very fast, however,  the result set saved as a PDF is about 10% of the actual report data set.  Exporting to excel is OK...  but PDF seems to have a limit. Is there a setting (webi processing server/Ado

  • Change the Theme of the Portal

    Hi experts, I have a question. After I've created a new theme for the Portal, how can I assign it to a user or a group of users or a business role? Thanks in advance, Andrea

  • Routing FAIL

    i have a problem accessing "certain" websites. and it seems like its either blocked by verizon(highly doubt) or theres problem with routing. the website address is dreamdota.com which has ip address of 106.187.37.80 first i did some traceroute as you

  • Editing scanned pics

    Sometimes I cannot edit scanned pix in Photo Gallery - even some I've already edited before. At other times there's no problem. There must be something I'm missing -- suggestions welcome!

  • Brightness keys stopped working; won't restart or shut down

    A couple days ago my brightness and volume keys stopped working. I thought restarting my computer (i also needed to restart it to install a software update) would fix this problem but then realized my Mac won't go to sleep, restart, or shut down. Any