-
-
Notifications
You must be signed in to change notification settings - Fork 5
Added examples and adv. subdirectories #14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great Examples! I do not see any issues.
Don't really know what a negative sum is, but if it is just those power and multiplicative operations then it's all good. The iterative/recursive methods for those agree so I think that should be ok.
…into neha-practice
…into neha-practice
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remaining comments which cannot be posted as a review comment to avoid GitHub Rate Limit
reviewdog
src/com/codefortomorrow/advanced/chapter14/examples/TryWithResources.java|2 col 1| 'import' should be separated from previous statement.
src/com/codefortomorrow/advanced/chapter14/examples/TryWithResources.java|2 col 15| Using the '.' form of import should be avoided - java.io..
src/com/codefortomorrow/advanced/chapter14/examples/TryWithResources.java|13 col 13| 'while' construct must use '{}'s.
src/com/codefortomorrow/advanced/chapter14/examples/TryWithResources.java|14 col 54| 'typecast' is not followed by whitespace.
src/com/codefortomorrow/advanced/chapter14/solutions/Bank.java|33 col 9| Distance between variable 'account2' declaration and its first usage is 4, but allowed 3. Consider making that variable final if you still need to store its value in advance (before method calls that might have side effects on the original value).
src/com/codefortomorrow/advanced/chapter14/solutions/Bank.java|44 col 5| Missing a Javadoc comment.
src/com/codefortomorrow/advanced/chapter14/solutions/Bank.java|54 col 1| Top-level class BankAccount has to reside in its own source file.
src/com/codefortomorrow/advanced/chapter14/solutions/Bank.java|66 col 9| 'if' construct must use '{}'s.
src/com/codefortomorrow/advanced/chapter14/solutions/Bank.java|77 col 1| Top-level class NotEnoughMoneyException has to reside in its own source file.
src/com/codefortomorrow/advanced/chapter14/solutions/Average.java|3 col 15| Using the '.' form of import should be avoided - java.io..
|
||
public static void main(String[] args) { | ||
System.out.println("Iterative:"); | ||
int a = 50, b = 40; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[reviewdog] reported by reviewdog 🐶
Each variable declaration must be in its own statement.
public static void main(String[] args) { | ||
System.out.println("With iterative function:"); | ||
|
||
int a = 72, b = 20; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[reviewdog] reported by reviewdog 🐶
Each variable declaration must be in its own statement.
|
||
int a = 72, b = 20; | ||
while (a != b) { | ||
if (a > b) a -= b; else if (b > a) b -= a; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[reviewdog] reported by reviewdog 🐶
'if' construct must use '{}'s.
|
||
int a = 72, b = 20; | ||
while (a != b) { | ||
if (a > b) a -= b; else if (b > a) b -= a; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[reviewdog] reported by reviewdog 🐶
'if' construct must use '{}'s.
|
||
int a = 72, b = 20; | ||
while (a != b) { | ||
if (a > b) a -= b; else if (b > a) b -= a; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[reviewdog] reported by reviewdog 🐶
Only one statement per line allowed.
|
||
import java.io.*; | ||
|
||
public class FileIO { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[reviewdog] reported by reviewdog 🐶
Abbreviation in name 'FileIO' must contain no more than '1' consecutive capital letters.
in = new FileInputStream(file); | ||
out = new FileOutputStream("names_upper.txt"); | ||
int c; | ||
while ((c = in.read()) != -1) out.write( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[reviewdog] reported by reviewdog 🐶
'while' construct must use '{}'s.
System.out.println("An IO Exception occurred."); | ||
e.printStackTrace(); // Prints error output stream. | ||
} finally { | ||
if (in != null) in.close(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[reviewdog] reported by reviewdog 🐶
'if' construct must use '{}'s.
e.printStackTrace(); // Prints error output stream. | ||
} finally { | ||
if (in != null) in.close(); | ||
if (out != null) out.close(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[reviewdog] reported by reviewdog 🐶
'if' construct must use '{}'s.
} | ||
|
||
public static void call(String s) throws MyException { | ||
if (s == null) throw new MyException(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[reviewdog] reported by reviewdog 🐶
'if' construct must use '{}'s.
Examples for Ch. 13/14
Created chapter (example, practice, solutions) subdirectories for advanced.