• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

javac and implicit compilation of 'friends'

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I've got a question about what exactly happens when I compile a class with javac. Relevant bits of my test classes are:

TestTypes.java

Horse.java

Halter.java


1. I compile all classes and run TestTypes:
2. I then comment out the tie method in Halter.java:
--> This seems obvious: I didn't recompile Halter.java.
3. I then comment out the myHalter = new Halter(); in Horse.java's constructor:

Note that in step 3, i only compiled TestTypes.java. However, unlike Halter.java, Horse.java was re-evaluated (compiled?) upon doing so.

This leads me to my question:
* What classes are, in general, compiled if I use javac in one class? Are the general rules on what gets compiled / evaluated described somewhere?
* When taking the exam, can I get confronted with a question that requires this knowledge, i.e. 'class Y is modified and class X is compiled, what is the output?'


Thanks!

 
Rancher
Posts: 1059
27
Netbeans IDE Oracle MySQL Database Tomcat Server C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Modified dependent classes are recompiled. I do not know if there is a setting to override that behavior.
 
I'm not dead! I feel happy! I'd like to go for a walk! I'll even read a tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic