Posts

Showing posts with the label declaration

Eclipse PDE: Everything about Editor Part 2

Document Partition In this series of “ Eclipse PDE: Everything about Editor ”, this post explains how to configure your document to represent different partition. Document partitions helps to manipulate different part of document in different way. For example there is not need to showing content assist in single line comment or multi line comment. Here I am explaining defining partition for single and multi line comments 1. Define a custom partition scanner Eclipse framework provides Rule based partition scanner, which allows us to define single or multi line rule for partitioning document content. We need to define Custome partition scanner extending org.eclipse.jface.text.rules.RuleBasedPartitionScanner . Override the constructor and define rules for partition . Below code snippets defines rule for single and multi line comments public class MyPartitionScanner extends RuleBasedPartitionScanner { //Define COnstants for supported partition types public static ...

Java Puzzle : Function parameters

Here is another Java puzzle, but this time you don’t need to find output of this program. Instead just complete the code snippet to get desired output. Here is the program : public class OPuzzle { public static void main(String[] args) { Object o = null; printMe(o); } private static void printMe(<Provide the declaration here> o){ if (o!=null){ System.out.println( "I am not null" ); } } } Desire output : I am not null Replace the <Provide the declaration here> with appropriate declaration to get above desired output. Leave your comments. Reference : http://google-opensource.blogspot.com/2011/04/geek-time-with-josh-bloch.html   No no no … don’t see reference before solving :).