title: using a variable of a class in another class in java
body: <p>Hello i am new to programming. I have a basic doubt, hope it's not silly. I have 2 classes,  my first class named <code>dialytravel</code> calculates money spend in travel on one day. In my second class names <code>weaklytravel</code> I want to use the sum(from the <code>dailytravel</code> class) to calculate the weakly cost for traveling. my code is bellow</p>
  
  <pre><code>Public class dailytravel {
  
        private int morning = 3;
        private int evening = 3;
        private int sum;
        sum = morning+evening;
  
        System.out.println("The money sent for travel in one day" +sum);
  }
  </code></pre>
  
  <p>Below is my second class named weaklytravel. How can I use sum in this class.</p>
  
  <pre><code>Public class weaklytravel {
  
        private int noofday = 5;
        private int weakly ;
  
        weakly = sum * noofdays;
        System.out.println("The money sent for travel in one weak" +weakly);
  
  }
  </code></pre>