Static class variable doesn't store ?

Hi,
I'm a beginner in java.
I defined a static class variable (nodes) in th following code :
public class MySOMapp extends javax.swing.JFrame {
     private static final long serialVersionUID = 1L;
     private static SOMTrainer trainer;
     private static SOMLattice lattice;
     private static SOMNode nodes;
     private static Hashtable nwordf; 
     public MySOMapp(String args[]) {
          SOMNode nodes = new SOMNode();          //.....But a method of this class, nodes comes null. methos definition :
private void makesame() {I don't understand why the nodes is null in makesame method which is in the same class with nodes ?
thanks,
Yigit

A: static class variable doesn't store ?

thankyou. I solved the problem. But why static fields
are not good idea ? How can i get rid of these...Remove the static word :) Seriously, try to develop a technique to get swiftly out of the static main method. Like this:
class MyClass {
    MyClass() {
        // Your code here instead of in main method.
    public static void main(String[] args) {
        new MyClass();
}

thankyou. I solved the problem. But why static fields
are not good idea ? How can i get rid of these...Remove the static word :) Seriously, try to develop a technique to get swiftly out of the static main method. Like this:
class MyClass {
    MyClass() {
        // Your code here instead of in main method.
    public static void main(String[] args) {
        new MyClass();
}

Similar Messages

  • Static class variable

    Folks:
    I am little confused by static class variables in Java. Since Java doesn't have global varaibles it uses static variables instead. Please take a look at the following code and please tell me what goes wrong.
    /********** CONTENT OF Stack.java ***********/
    import java.util.Stack;
    public class StackClass
    {   static  Stack stack = new Stack (); }
    /********** CONTENT OF Test1 .java ***********/
    public class Test1
    public static void main( String[] args )
    StackClass.stack.push("Hello World");
    /********** CONTENT OF Test2.java ***********/
    public class Test2
    public static void main( String[] args )
    System.out.println( "Top on stack is " + StackClass.stack.peek() );
    I execute the above programs in the sequence of StackClass.java, Test1.java and Test2.java. I think in Test1.java after I push one element to the stack it should still be in the stack in Test2.java But I got :
    java.util.EmptyStackException
         at java.util.Stack.peek(Unknown Source)
         at Test2.main(Test2.java:16)
    Exception in thread "main"
    Can anybody give me a hint?
    Thanks a lot !

    After you run StackClass, the JVM (java.exe) ends and all the classes are unloaded including StackClass
    When you run Test1, StackClass is loaded, an item is pushed on the stack, and then the JVM exits and all classes are unloaded including StackClass
    When you run Test2, StackClass is loaded, and you get an error because the StackClass which was just loaded has no items in it.

  • Static class variable gets initialized ALWAYS

    I have the following code...
    public class SystemMonitor //extends Thread
         private static SystemMonitor SysMon;//= getInstance();
         private CLSTrackerAgent CLSTrackerAgent;// = new CLSTrackerAgent();     
         private RequestDispatcher ReqDispatcher;// = RequestDispatcher.getInstance();
         private ConnectionManager ConMgr;// = ConnectionManager.getInstance();
         private UploadManager UploadMgr;// = UploadManager.getInstance(ConMgr);
         private DownloadManager DownloadMgr;// = null;
         private FileWriter fwUploader = null;
         private FileWriter fwDownloader = null;
    //     public static void main(String args[])
         private SystemMonitor()
              try
    //               CLSTrackerAgent = new CLSTrackerAgent();     
                   ReqDispatcher = RequestDispatcher.getInstance();
                   ConMgr = ConnectionManager.getInstance();
                   UploadMgr = UploadManager.getInstance(ConMgr);
    //               DownloadMgr = new DownloadManager(CLSTrackerAgent);
                   fwUploader = new FileWriter("d://UploaderStats.xls");
                   fwDownloader = new FileWriter("d://DownloaderStats.xls");
                   String temp = "Uploader" + "\t" + "RemoteIP:Port" + "\t" + "RequestMsg" + "\t" + "Time" + "\t" + "ResponseMsg" + "\t" + "ChunkID" + "\t" + "Time" + "\t" + "TotalUploaderThreadsAlive" + "\n";
                   fwUploader.write(temp.toCharArray());
                   fwUploader.flush();
                   temp = "Downloader" + "\t" + "RemoteIP:Port" + "\t" + "RequestMsg" + "\t" + "Time" + "\t" + "ResponseMsg" + "\t" + "ChunkID" + "\t" + "Time" + "\n";
                   fwDownloader.write(temp.toCharArray());
                   fwDownloader.flush();
              catch(Exception e)
                   e.printStackTrace();
    public static SystemMonitor getInstance()
              if(SystemMonitor.SysMon instanceof SystemMonitor)
                   return SystemMonitor.SysMon;
              else
                   SystemMonitor.SysMon = new SystemMonitor();
                   return SystemMonitor.SysMon;
    I invoke the getInstance() method to get the same STATIC object that I have created. However, whenever I invoke the getInstance() method the eclipse debug utility shows SysMon = null....PLEASE HELP

    Singletons are done this way:
    public class SystemMonitor //extends Thread
    private static SystemMonitor SysMon = new
    SystemMonitor();
    // some stuff removed for clarity
    public static SystemMonitor getInstance()
    return SysMon;
    I say "why bother with that static method?".

  • Static class reference

    Below we have a class containing a static class variable and a static accessor method.
    The method is responsible for assigning the variable, which it does on demand.
    public class MyClass
        private static int INFO = -1;
        public static int getInfo()
            if(INFO < 0)
                try
                    INFO = ...;
                catch(Exception e)
            return INFO;
        }When using this class is it not safe to assume that the assignment of the variable will ever only occur once for the life of the system that uses this class? (afterall is it static within the class)
    I am experiencing the situation whereby EVERY time the method is called, the assignment of the variable is necessary. I can only assume that the static instance of this class in memory has been lost between each call and therefore the state/value of the variable has also been lost.
    It is worth noting that no object instances of this class are ever created. The class is accessed only through its static interface. It seems that since no local reference to objects of this class are held in memory then the entire class, along with its internal static state, is cleared from memory (garbage collected?).
    How is it possible to ensure that the state of static fields within such a class is preserved over time, without create instances of the class.
    John

    When using this class is it not safe to assume that
    the assignment of the variable will ever only occur
    once for the life of the system that uses this class?First of all, you haven't said what you assign it to, so we can't say. If you assign a value less than zero then it will be reassigned next time the method is called.
    Secondly, it depends on whether or not you're expecting it to be thread-safe? It isn't.
    If your code is not multi-threaded, then the section of code in your getInfo method that assigns the field should only execute once during a single run of an application.
    Thirdly, you explicitly assign it (to minus one) at class initialisation time, so stricty speaking, the variale will always be assigned at least once, and will be assigned at least once more if the getInfo method is ever called.
    I am experiencing the situation whereby EVERY time the
    method is called, the assignment of the variable is
    necessary. Can you offer any evidence to this? A small, complete, compilable and executable example that demonstrates the problem will help, and will probably get you an answer pretty quickly around here.
    I can only assume that the static instance
    of this class in memory has been lost between each
    call and therefore the state/value of the variable has
    also been lost.Then either there is a bug in your JVM, or at least two versions of the class have been loaded, and at least one of those was not loaded by the system classloader. Without further info, we aren't going to be able to help much more here.
    The class is accessed only
    through its static interface. It seems that since no
    local reference to objects of this class are held in
    memory then the entire class, along with its internal
    static state, is cleared from memory (garbage
    collected?).This is not allowed under the JLS if the class was loaded by the system classloader. If it was loaded by another classloader, then it is only allowed if it can be determined that the class will never again be used throughout the entire run of the application. Since you are referencing the class again, this should not be happening.
    How is it possible to ensure that the state of static
    fields within such a class is preserved over time,
    without create instances of the class.From what you have told us so far, it should be. You will probably have to provide some code for us to help you further.

  • Static class

    Hello
    at the start of my programme I would like to store some valuse (the values are trhe user rights that will be read from the data base) these values will never change during the execution of the programme.
    so I was told that the best is to create a static class ...
    can any one post an example of static class and how to store the values inside
    and how to read it back
    or just any link that speak about this
    thank you in advance.

    yeah i understand the ?:;
    my question was on the form of the newthe code checks to see if an instance of Example already exists, and if it does, it returns that. if not, it creates a new one first. theoretically, only one instance will ever exist, but in practice, this variant of the pattern isn't thread-safe. simplest singleton:
    public class MySingleton {
      private static MySingleton INSTANCE = new MySingleton();
      private MySingleton() {}
      public static MySingleton getInstance() {
        return INSTANCE;
    }still lazily-loaded, despite what people might tell you, since the class itself is only loaded when you first need it

  • Static Class Function vs. Instance Variables

    I'm making a Wheel class to spin the wheels on some toy
    trains as they move back and forth.
    Each wheel on the train is an instance of the Wheel class and
    there are several of them.
    I thought it would be great to just have a static class
    function to tell all the Wheels to start turning:
    Wheel.go();
    The Wheel class keeps a static array of all of its instances
    so I thought I would just loop through all of those instances and
    issue the wheelInstance.roll() method.
    So far it all works. But I was planning to use a setInterval
    to call the roll() method and each instance has its own rollID
    property that I would like to assign the setInterval ID to. Here is
    the problem.
    Since the rollID is an instance property I can't access them
    from a static class function. Is there any way to do this?
    Currently I"m just using an onEnterFrame which doesn't require me
    to use the instance properties.

    Technically yes, realistically for this class no.A
    class will probably take several hundred bytes at
    least to load, with no data of your own. So adding4
    bytes for a int is less than 1% of the total size.
    And if you are loading millions of differentclasses
    then you should rethink your design.If you don't instantiate the class when you reference
    a static variable why would you consume memory for the
    class other than the variable itself? I don't
    understand what you are talking about with the
    "millions of different classes", it's not germane to
    the question. Bottom line, referencing a static
    variable more than once will save memory.Using a class, static or by instance, requires that the class be loaded. A loaded class creates, at the very least, an instance of java.lang.Class. Any static members of the class are in addition to the storage space needed for the instance of java.lang.Class and for any internal storage needed by the JVM in addition to that.
    Thus if one has a static data member when the class is used in any way, the static data member takes storage space. However a member (non-static) does not take storage space.
    Of course the meta data for the member could take as much space as the static member so the point could be moot. Is that what you were referring to?

  • Convertion of class variable (static) into instance variable(non-static)!

    Dear all,
    got a slight different question.
    Is that possible to convert class variable (static) into instance variable(non-static)?
    If so, how to make the conversion?
    Appreciating your replies :)
    Take care all,
    Leslie V
    http://www.googlestepper.blogspot.com
    http://www.scrollnroll.blogspot.com

    JavaDriver wrote:
    Anything TBD w.r.to pass by value/reference (without removing 'static' keyword)?Besides the use of acronyms in ways that don't make much sense there are two other large problems with this "sentence".
    1) Java NEVER passes by reference. ALWAYS pass by value.
    2) How parameters are passed has exactly zero to do with static.
    Which all means you have a fundamentally broken understanding of how Java works at all.
    Am I asking something apart from this?
    Thanks for your reply!
    Leslie VWhat you're asking is where to find the tutorials because you're lost. Okay. Here you go [http://java.sun.com/docs/books/tutorial/java/index.html]
    And also for the love of god read this [http://www.javaranch.com/campfire/StoryPassBy.jsp] There is NO excuse for not knowing pass-by in Java in this day and age other than sheer laziness.

  • Class variables x static ones

    I am with a doubt. I would like that the variables I have in the c program behave as class variables and it do not occur, tghey behaves more like static variables. By any chance any one knows if its possible that the c internal variables behave like class variables?
    I am putting down the helloworld example and the output.
    --------- HelloWorld.c -----------------------------
    #include <jni.h>
    #include "HelloWorld.h"
    #include <stdio.h>
    int test = 0;
    JNIEXPORT void JNICALL
    Java_HelloWorld_hello(JNIEnv *env, jobject obj) {
    printf("Hello world! %d\n", test++);
    return;
    ------HelloWorld.java------------
    public class HelloWorld {
    public native void hello();
    static {
    System.loadLibrary("hello");
    public static void main(String[] args) {
    HelloWorld hw = new HelloWorld();
    hw.hello();
    hw.hello();
    hw = null;
    HelloWorld hw2 = new HelloWorld();
    System.out.println("-----------");
    hw2.hello();
    hw2.hello();
    ---------- output-----
    /testeHello @varda : java HelloWorld
    Hello world! 0
    Hello world! 1
    Hello world! 2
    Hello world! 3
    ---- I would like it was.....
    /testeHello @varda : java HelloWorld
    Hello world! 0
    Hello world! 1
    Hello world! 0
    Hello world! 1

    Thanks. I thought in let the variables I need in the Java class... However I think it would not work, I have some pretty complex structures in C that I would need to port to java, without to say I have some sockets and pointers also. First I really don't know if it is feasible, and second even if it is feasible It would be a lot of work, I know I am lazy :). The problem is that some of these need to be global, I really can't do in other way.
    Actually what I am doing is exactly create a vector to each global variable I need and I am also putting an ID at the Java class. In this way the C method know who is calling it and uses the id as index of the vector. Well It works, but I think it is pretty ugly (we call this kind of thing as "Hammer" :) and I would like to use some thing better ;).

  • Static classes and variables

    Hello,
    I put all of my constants in an *{color:#3366ff}interface{color}* called Constants.java (I only put constants in this file) and when obfuscated the Constants.class file is removed from .jar and constants are inlined into classes this is Great! However, do I gain anything by placing all of my static methods into one class? Currently, there are all over the place and also I have classes that are already static like HttpMgr.java/ErrorMgr.java/InfoMgr.java I am thinking about merging these classes together with all static methods defined within the project. Do I gain or loss anything by doing this?
    Thanks!

    you will gain some bytes by merging all the static classes in one.
    you can create a ManagerTool.java class and write inside all the static methods ...

  • How to access the parent class variable or object in java

    Hi Gurus,
    I encounter an issue when try to refer to parent class variable or object instance in java.
    The issue is when the child class reside in different location from the parent class as shown below.
    - ClassA and ClassB are reside in xxx.oracle.apps.inv.mo.server;
    - Derived is reside in xxx.oracle.apps.inv.mo.server.test;
    Let say ClassA and ClassB are the base / seeded class and can not be modified. How can i refer to the variable or object instance of ClassA and ClassB inside Derived class.
    package xxx.oracle.apps.inv.mo.server;
    public class ClassA {
        public int i=10;
    package xxx.oracle.apps.inv.mo.server;
    public class ClassB extends ClassA{
        int i=20;   
    package xxx.oracle.apps.inv.mo.server.test;
    import xxx.oracle.apps.inv.mo.server.ClassA;
    import xxx.oracle.apps.inv.mo.server.ClassB;
    public class Derived extends ClassB {
        int i=30;
        public Derived() {
           System.out.println(this.i);                  // this will print 30
           System.out.println(((ClassB)this).i);  // error, but this will print 20 if Derived class located in the same location as ClassB
           System.out.println(((ClassA)this).i);  // error, but this will print 20 if Derived class located in the same location as ClassA
        public static void main(String[] args) { 
            Derived d = new Derived(); 
    Many thanks in advance,
    Fendy

    Hi ,
    You cannot  access the controller attribute instead create an instance of the controller class and access the attribute in the set method
    OR create a static method X in the controller class and store the value in that method. and you can access the attribute by 
    Call method class=>X
    OR if the attribute is static you can access by classname=>attribute.
    Regards,
    Gangadhar.S
    Edited by: gangadhar rao on Mar 10, 2011 6:56 AM

  • Dynamic or Static Class

    Dynamic or Static Objects
    It seems to me there is a big cliff at the point of deciding to instantiate your class at runtime or static load
    on start-up.
    My swf apps have a pent-up burst that happens a couple seconds into the run. I think I get this on most
    web pages that have flash banners.
    Flash apps that have a loader bar can take 60 secs. These ones usually come on with a bang with a lot of
    high quality graphics.
    Therer is a big processor spike at start-up with the browser loading http page. Flash seems to want a big spike
    with its initial load. The javascript embed doesn't help either.
    How to get a smooth start-up? Me English good.
     

    This seems like a matter of correctness, only indirectly relating to speed.
    The speed that a SWF loads from a web page is determined by many things, like server connection speed, client connection speed, browser cache size, client RAM, etc.  Having static vs. dynamic classes would not impact this very much.
    First of all, "static objects" is kind of an oxymoron because you can't instantiate (create an object) of a static class.  I would say that having static variables/methods in a class is usually when you want some shared values/functionality without requiring an actual object (taking up memory) -- although static practices certainly extend beyond just this.  I always try to think of a Math class.  You wouldn't have to have to say m = new Math() just to use some common methods (square, sin, cos, etc.) or values (pi, e, etc.).  They become kind of like "global constants/methods" in a sense (not to invoke the debate over correctness of that wording).
    In short, it's more of a memory issue, which will like not have much influence over loading speed.  If you want to improve your loading speed, you can try to delay the creation of your objects based on certain events instead of having them all load at startup.
    How to get a smooth start-up? Me English good.

  • Are private fields public in a static class?

    If a variable in a static class is declared as private, it still seems to be visible. Are access specifiers without any importance in a static class?

    Roxxor wrote:
    tschodt wrote:
    The outer class can access all the fields of the nested class, yes.Yes, but only if the nested class is static, otherwise not.
    This is what I have noticed:
    If the nested class is not static, then the outer class has to instantiate the nested class to access its variables. Well, not really. If the nested class is not static (i.e., it's a nested class), then its variables don't even exist until an instance is created.
    If the nested class is not static, then the nested class can access the outer class´ variables without instantiate it. The inner class can only exist if there exists an instance of the outer class. An inner class (a non-static nested class) contains a reference to the wrapping class. So, it doesn't have to instantiate the outer class, because an instance already exists.
    If the nested class is static, then the nested class has to instantiate the outer class to access its variables. I guess. It seems like a really strange design though.

  • Static class error

    I have a static class:
    package VO
        public class ArrayValues
            private static var instance:ArrayValues = new ArrayValues();
            // dummy values will be first replaced with English versions
            // if the user clicks "Spanish" they will be replaced with that
            private var yesNoArray:Array = new Array('1','2');
            private var utilityArray:Array = new Array('1','2');
            public function ArrayValues()
                throw Error("ArrayValues is called by its instance");
            public static function getInstance():ArrayValues
                return instance;
            public function getYesNoArray():Array
                return yesNoArray;
            public function setYesNoArray(input:Array):void
                yesNoArray = input;
    It is invoked here:
            import VO.ArrayValues;
            import VO.InputData;
            import VO.InputLabels;
            [Bindable]
            public var saveData:InputData = InputData.getInstance();
            [Bindable]
    168       public var getArrays:ArrayValues = ArrayValues.getInstance();
    It produces this error:
    Error: ArrayValues is called by its instance
        at VO::ArrayValues()[C:\FSCalc\Flex\FSCalc\src\VO\ArrayValues.as:14]
        at VO::ArrayValues$cinit()
        at global$init()[C:\FSCalc\Flex\FSCalc\src\VO\ArrayValues.as:3]
        at components::InputForm()[C:\FSCalc\Flex\FSCalc\src\components\InputForm.mxml:168]
        at FSCalc/_FSCalc_InputForm1_i()
        at FSCalc/_FSCalc_Array6_c()
    What am I doing wrong?
    PS, is it normal to take almost 10 minutes to a) go to your discussions, b) read one response to one thread and c) get back to the normal discussion?  That seems excessive to me.

    Sorry for the late reply.  I've just got back to this project after the usual "an emergency" stuff.
    Yes, I'm looking to create a singleton.  I want to pass values around without having to have monster long parameter lists for the various components.
    I based the Flex I have on a web page and noted it is similar to the java idea, but not identical based on that page.
    I want to make sure I understand the theory behind the code.
    public function ArrayValues(access:SingletonEnforcer)
         if ( access == null )
              throw Error("ArrayValues is called by its instance");
    This is the constructor for the class which has the same name as the file it is in.  A parameter is passed of the type "SingletonEnforcer" and is then tested to see if it were ever invoked.  If it were, an error is created with a string which will be written to the console.
    Next, a variable local to this class is created that will be of the type "ArrayValues" to hold the various arrays.  BTW, either this will have to be expanded or a parallel class created to hold the Spanish values.
    static private var _instance  :  ArrayValues;
    Next, the actual work horse and true "constructor" is made.  This will either allocate a new instance of the class if it doesn't already exist or instantiate it if it doesn't.  I am confused by the second class, however, when it is created the first time.  This class is included in this file?  Doesn't the file name have to match the class?

  • Class variables don't exist at initialize() time?

    Excerpt of Slam.mxml (default package):
    <?xml version="1.0" encoding="utf-8"?>
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                      xmlns:s="library://ns.adobe.com/flex/spark"
                      xmlns:mx="library://ns.adobe.com/flex/mx"
                      xmlns:components="components.*"
                      minWidth="955" minHeight="600" width="1000" height="720"
                      initialize="Initialize()"
                      creationPolicy="auto">
         <fx:Script>
              <![CDATA[
                   protected function Initialize():void
                        Global.app = this;
              ]]>
         </fx:Script>
    </s:Application>
    Excerpt of Global.mxml (default package):
    <?xml version="1.0" encoding="utf-8"?>
    <fx:Object xmlns:fx="http://ns.adobe.com/mxml/2009"
                 xmlns:s="library://ns.adobe.com/flex/spark"
                 xmlns:mx="library://ns.adobe.com/flex/mx">
         <fx:Script>
              <![CDATA[
                   public static var app:Slam = null;
              ]]>
         </fx:Script>
    </fx:Object>
    When I run the app I get an error in Initialize() because Global is null.  Global is a class name and Global.app is a class variable, a static.  How can they not exist at initialize time?  Suggestions for how to deal with this?  Thanks.

    No, running just these files doesn't exhibit the issue for me.  I'm using Flex 4.1.  However, I was able to come up with a minimal set of files that does show the problem.  Slam.mxml is the same as before.  Global.mxml becomes:
    <?xml version="1.0" encoding="utf-8"?>
    <fx:Object xmlns:fx="http://ns.adobe.com/mxml/2009"
         xmlns:s="library://ns.adobe.com/flex/spark"
         xmlns:mx="library://ns.adobe.com/flex/mx">
         <fx:Script>
              <![CDATA[
                   public static var app:Slam = null;
                   public static const WIDGET_COLOR:uint = 0x987654;
                   public static var widgets:Widgets = new Widgets();
              ]]>
         </fx:Script>
    </fx:Object>
    and add an additional file, Widgets.as:
    package
         public class Widgets
             public function Widgets()
                  wColor = Global.WIDGET_COLOR;
             protected var wColor:int;
    This blows up with Global == null at the wColor initialization in Widgets.as.  I suspect there is some sort of chicken-and-egg issue going on here.  That Global isn't fully setup until it has initialized its widgets member, but initializing the widgets member needs Global fully setup.
    Moving the initialization of the widgets member to a separate Initialize function in Global, called from Slam.Initialize(), fixes the problem.

  • Do Static Classes exist?

    Does Java allow the creation of static classes, and if so does that mean an instance of the class cannot be created? I know that a class can have static methods that only access static instance variables, but I don't know if that means that the class itself is static. I ask because I realized that you can't declare a static class like "public static class A {...}"

    @OP. An inner class can be declared to be static,but
    top level classes can't be static.
    But that doesn't mean the static inner class
    can't be instantiated (which seems to be what the OP
    is thinking of).That was an answer to the topic - "Do static classes exist?", and the question does also say:
    "Does Java allow the creation of static classes, and if so does that mean an instance of the class cannot be created?"
    So I thought that the OP also wanted to know if static classes existed.
    Kaj

Maybe you are looking for

  • Re-installation of a damaged/partial install of Oracle Dev Suite 10g (9.0.4

    Hi First of apologies if this is the incorrect location to post - I couldn't find a dedicated forum!! My problem is this...... I have followed Oracle's guidelines and created a silent installation of the full Dev Suite 10g (9.0.4) and have used this

  • How to change the Format Colour?

    Hi, I found that something are really useful~in the Inspector~Link tab~Format tab,it can change the colours of the instruction like NEXT,PREVIOUS... But this useful skil only able to apply on some pages like the Blog~Entries;but it seems doesn't work

  • Why doesn't the iPhone and ipad sinc?

    Why doesn't the iPhone and ipad sinc?

  • Rconfig: converting a single instance to RAC instance

    Hi, I am trying to use the "rconfig" utility to convert a single instance to a RAC instance in an existing RAC cluster. I have modified the .xml file, and am trying to run the conversion from the 1st node in the 2 node cluster (where the single insta

  • Bonjour Weird Printing Issue Windows

    I have windows xp ruuning inside of parallels on a powerbook. I'm Running bonjour on the windows side so I can print to my lexmark printer which is hooked up to my G4 desktop via USB. When I print from my laptop wirlessly from my laptop on the mac si