I'm not quite sure what you mean
To do Key-Value mappings I'd just use a HashMap, why recreate the wheel? Also why the "no method" restriction? Do you mean no static methods or no methods at all? None at all means you can't even print anything... Unless you meant no creation of ADDITIONAL methods, in which case the following (awful) code would fit all the requirements:
Code:
public class Entry
{
public final K key;
public final V value;
public Entry(K key, V value) {
this.key = key;
this.value = value;
}
}
Then your "app" would have an array of these, it would cycle through them and compare keys to the input key, and once a match is found the value is printed.
This implementation is not OO though. The key idea of OOP is that objects aren't just 'things' that hold data - objects are defined by
behaviour and well, this object has none. [emoji14] not to mention it's completely inefficient - like I said, don't reinvent the wheel!
Why am I not studying for my trial tomorrow?