Does the following aspect compile AJC compiler?
If so, what will it output to the console during compilation?
')
public aspect QuizAspect { public static int count(int i) { return i++; } before (int n) : execution(public int QuizAspect.count(int)) && args(n) && if(QuizAspect.count(1)>1) { System.out.println("QuizAspect " + n); } }
What is the catch to delete Java comments with such an expression? List 3 reasons why this should not be done. (we believe that the source code is written in normal characters) -
Pattern.compile("/\\*(?:[^*]|\\*[^/])*\\*/")
And the second task right away - is it possible to write “hello world” on java without a single space?
There are 2 Spring contexts:
1. a.xml with bin
<util:list id="myList"> <value>3</value> <value>4</value> </util:list>
2. b.xml with bin
<util:list id="myList"> <value>6</value> </util:list>
What a code snippet prints:
System.out.println(new ClassPathXmlApplicationContext("a.xml", "b.xml").getBean("myList"));
And how can you get him to throw an error without changing the logic of the code?
Below are 2 programs. Each of them tries to allocate a total of memory larger than the size of the heap. But one of them throws out java.lang.OutOfMemoryError, and the second does not. Why?
public class OOM1 { private static final int SIZE = (int) (Runtime.getRuntime().maxMemory() * 0.55); public static void main(String[] args) { { byte[] bytes = new byte[SIZE]; System.out.println(bytes.length); } byte[] bytes1 = new byte[SIZE]; System.out.println(bytes1.length); System.out.println("I allocated memory successfully"); } } public class OOM2 { private static final int SIZE = (int) (Runtime.getRuntime().maxMemory() * 0.35); public static void main(String[] args) { { byte[] bytes = new byte[SIZE]; System.out.println(bytes.length); } byte[] bytes1 = new byte[SIZE]; System.out.println(bytes1.length); byte[] bytes2 = new byte[SIZE]; System.out.println(bytes2.length); System.out.println("I allocated memory successfully"); } }
What will this code output?
def back = 'back' def quotes = ["I'll be $back", "I'll be ${-> back}", "I'll be ${back}", "I'll be "+back] println quotes back = 'bach' println quotes
There are two bins:
@Component public class { public void closeAll() { while (()) { (); } } } @Component public class { public void closeAll() { while (()) { (); } } }
How to make, that at context closing, both methods closeAll worked in parallel (and what options are)?
Source: https://habr.com/ru/post/255869/
All Articles