Results 1 to 8 of 8

Thread: Simple Function problem ???

  1. #1
    DaoK
    Guest

    Simple Function problem ???

    Code:
    package StringManiPrg2;
    //Remove all number in a String
    
    public class StringManiPrg2
      {
    public static String Daok;
        public static void main ( String Args[])
        {
        String stringer;
        stringer = Daok("Big Big Show");
        System.out.println(stringer);
      }
    public static void Daok(String varStr)
      {
      // System.out.println (varStr);
      Daok ="$$$ " + varStr + " $$$";
      }
    }
    What I have to do to change that code to be able to use it because I got always an error.

  2. #2
    DaoK
    Guest
    Filburt come see that code I know it's easy for you

  3. #3
    *ahem*
    Code:
    package StringManiPrg2;
    //Remove all number in a String
    
    public class StringManiPrg2
    Do you understand the purpose of packages?

  4. #4
    AGH! YOU'RE USING A VB CONVENTION FOR THE FAR SUPERIOR JAVA! Burn!
    Code:
    public class StringManiPrg2
      {
    public static String Daok;
        public static void main ( String Args[])
        {
        String stringer;
        stringer = Daok("Big Big Show");
        System.out.println(stringer);
      }
    public static String Daok(String varStr)
      {
      // System.out.println (varStr);
      return "$$$ " + varStr + " $$$";
      }
    }
    Also please fix up your indenting.

  5. #5
    DaoK
    Guest
    Thank you MasterTurtle. I have searched on Java.sun.org but it's so bull**** site so... Anyways, can you explain me package ? Because I never take care of that.

  6. #6
    Are you using JBuilder?

    Let me use some of my presigious and holy (not to mention uncompiling) code:
    Code:
    package com.turtletips;
    
    public class VBCodeParser
    {
        /**
         * Returns vBCode in HTML form instead of vB code form.
         * If allowGTLT is false then the angle brackets are replaced with the HTML
         * escape characters.
         *
         * @return HTML form version of s
         */
        public static String parseVBCode(String vBCode, boolean allowGTLT)
        {
            String s = vBCode;
            if (!allowGTLT)
            {
                s = Utilities.replacePattern(s, "<", "&lt;");
                s = Utilities.replacePattern(s, ">", "&gt;");
            }
            s = Utilities.replacePattern(s, "", "<i>");
            s = Utilities.replacePattern(s, "", "</i>");
            s = Utilities.replacePattern(s, "", "<b>");
            s = Utilities.replacePattern(s, "", "</b>");
        }
    
        public static void main(String[] args)
        {
            VBCodeParser.parseVBCode("Test");
        }
    }
    Let's say in some completely unrelated program I wanted to call main. I could not do this:
    Code:
    VBCodeParser.main();
    Rather I'd have to do this:
    Code:
    com.turtletips.VBCodeParser.main();
    The way I see it, it is basically a way to organize classes. Com means I have a commercial domain, TurtleTips is the name, and VBCodeParser is the class name. For my homework network at my site, the order goes org.riverhill.rhhshn.RHHSHNClass, org for organization, riverhill for River Hill, RHHSHN for the project name, and RHHSHNClass for the class name.

  7. #7
    FYI, if two classes are in the same package then you don't have to give the full package declaration, just the class name. You can still give the whole path if you want, it's just a bunch of unnecessary typing.

  8. #8
    DaoK
    Guest
    ok i understand simply good !!!! ahhh !!! yesyes !! I will be able to do code in multiple form instead of everything on one!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width