• 0
  • مالي خلق
  • أتهاوش
  • متضايق
  • مريض
  • مستانس
  • مستغرب
  • مشتط
  • أسولف
  • مغرم
  • معصب
  • منحرج
  • آكل
  • ابكي
  • ارقص
  • اصلي
  • استهبل
  • اضحك
  • اضحك  2
  • تعجبني
  • بضبطلك
  • رايق
  • زعلان
  • عبقري
  • نايم
  • طبيعي
  • كشخة
  • النتائج 1 إلى 6 من 6

    الموضوع: 11Those Who Are Expert in JAVA.

    1. #1
      التسجيل
      06-03-2005
      المشاركات
      6
      المواضيع
      3
      شكر / اعجاب مشاركة

      11Those Who Are Expert in JAVA.

      السلام عليكم


      Hi, if you are expert in java or you have enough idea about java please share some of you knowladge.

      i an assignment where we have to develop a parser for PHP .
      So, i'm doing that parser in Java. the thing i need is that ,
      HOW TO GET A CONSUOL INPUT FROM THE USER at run TIME ?
      i mean that , i must take character by character from the user and identify each when ever we get input until the semicolom accures,
      MORE: i need a function or a way to do the work of the function (getch()) of c++
      but in java.

      Please if you have an idea share it with me , if you don't please replay that you don't , cuz i have to check weither i wait for answer or switch to some other language than JAVA.

      Thanx for caring:icon6: .
      Mashkoooreen 3al ehtmaaam , yezaakom alla '7eer

      YOUR Bro. HassoN

    2. #2
      التسجيل
      30-12-2004
      المشاركات
      449
      المواضيع
      12
      شكر / اعجاب مشاركة

      مشاركة: 11Those Who Are Expert in JAVA.

      There are many ways, depending on where you want the input to come from. Rememer, java can be either an application (GUI, CLI) or applet. What form is your "php parser" in?

      There are TONS of I/O functions in the java.io.* package heirarchy. Your lexer will probably need to look-ahead tokens, so you might need to use the methods in the java.io.BufferedReader. If you're not reading from a file, but instead waiting for user input at the console (the user is typing the php code directly into the application shell) then you can use classes and methods in System.in.*, like:

      System.in.read (); /* read next byte*/
      System.in.read (byte[] n) /* read next n bytes */

      Though you might have to do your own buffering, and implement puting back tokens (ala ungetc ());

      http://java.sun.com/j2se/1.5.0/docs/...putStream.html

    3. #3
      التسجيل
      30-12-2004
      المشاركات
      449
      المواضيع
      12
      شكر / اعجاب مشاركة

      مشاركة: 11Those Who Are Expert in JAVA.


    4. #4
      التسجيل
      06-03-2005
      المشاركات
      6
      المواضيع
      3
      شكر / اعجاب مشاركة

      مشاركة: 11Those Who Are Expert in JAVA.

      MshKooor Brother for the reply,

      But the thing is i don't want to get the string of input , just i need to get character by character ,
      e.g.
      i/p= hassan
      i have to verify from the first character weither its right input or not , if not alert will be givent that first character can't be numeric for the identifier and complete the input of the identifier if it was alphabet right accourding to the language constraints.

      actually our teacher are not giving the marks if just submit the assignment with whole requirments but they are giving according to the level of the class , it means if any one in the class did it perfectly the rest will get 5/10 or less

      so i mean that just assume that you are constructing this part for a compiler.

      Thanx alot Bro.
      Your Bro. HasSoN

    5. #5
      التسجيل
      06-03-2005
      المشاركات
      6
      المواضيع
      3
      شكر / اعجاب مشاركة

      مشاركة: 11Those Who Are Expert in JAVA.

      mmmmmm, so if u have any English Forum related to java , where i can ask .


      the question is not about simply getting input or output
      cuz i think you didn't understand my question.

      anaywayz i'm so thanksful for your aswers

    6. #6
      التسجيل
      30-12-2004
      المشاركات
      449
      المواضيع
      12
      شكر / اعجاب مشاركة

      مشاركة: 11Those Who Are Expert in JAVA.

      كود:
      System.in.read ();
      Notice no argument there. It reads and returns the next input byte.

      كود:
      System.in.read (byte [] n);
      reads n number of bytes into the buffer (i.e. similar to gets ())

      It's all in the first link above; get ready to spend a substantial part of your life browsing the java documentation :-D hehehehe

    ضوابط المشاركة

    • لا تستطيع إضافة مواضيع جديدة
    • لا تستطيع الرد على المواضيع
    • لا تستطيع إرفاق ملفات
    • لا تستطيع تعديل مشاركاتك
    •