- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
A file is a collection of data stored in a disk with a specific name and a directory path. When a file is opened for reading or writing, it becomes a stream.In C#, you need to create a FileStream object to create a new file or open an existing file. The syntax for creating a FileStream object is as follows −FileStream = new FileStream( , , , );Here, the file operations are also included as shown below −The FileMode enumerator defines various methods for opening files. The members of the FileMode enumerator are −Append − It opens an existing ... Read More
Use the substring() method in C# to find all substrings in a string.Let’s say our string is −pqrLoop through the length of the string and use the Substring function from the beginning to the end of the string −for (int start = 0; start
Following programs shows the float arithmetic can cause dubious result if integer values are used using float variables.Examplepublic class Tester { public static void main(String[] args) { float a = 500000000; float b = -500000000; float c = 1; float sumabc1 = a+(b+c); float sumabc2 =(a+b)+c; System.out.println("Floating Point Arithmetic"); System.out.println("a + ( b + c ) : " + sumabc1); System.out.println("(a + b) + c : " + sumabc2); ... Read More
Java Byte streams are used to perform input and output of 8-bit bytes, whereas Java Character streams are used to perform input and output for 16-bit unicode. Though there are many classes related to character streams but the most frequently used classes are, FileReader and FileWriter. Though internally FileReader uses FileInputStream and FileWriter uses FileOutputStream but here the major difference is that FileReader reads two bytes at a time and FileWriter writes two bytes at a time.Following example, which makes the use of these two classes to copy an input file (having unicode characters) into an output file −Exampleimport java.io.*; ... Read More
A sorted list is a combination of an array and a hash table. It contains a list of items that can be accessed using a key or an index. If you access items using an index, it is an ArrayList, and if you access items using a key, it is a Hashtable. The collection of items is always sorted by the key value.Let us see an example wherein we added 4 key and value pair for SortedList −Exampleusing System; using System.Collections; namespace Demo { class Program { static void Main(string[] args) { ... Read More
The window.location object can be used to get the current URL.window.location.href returns the href(URL) of the current page.I am using these code in my MVC projet.Example var iid=document.getElementById("dd"); alert(window.location.href); iid.innerHTML = "URL is" + window.location.href;
The System.Reflection namespace contains classes that allow you to obtain information about the application and to dynamically add types, values, and objects to the application.It has a module constructor that initializes a new instance of the Module class. A module is a portable executable file that has one or more classes and interfaces.Let us see an example of System.Reflection in C# −Exampleusing System; using System.Reflection; [AttributeUsage(AttributeTargets.All)] public class HelpAttribute : System.Attribute { public readonly string Url; public string Topic // Topic is a named parameter { get { return ... Read More
Stack is used when you need a last-in, first-out access of items. When you add an item to the list, it is called pushing the item and when you remove it, it is called popping the item.Let us see an example of the stack class in C# −Firstly, add elements in the Stack.Stack st = new Stack(); st.Push('H'); st.Push('I'); st.Push('J'); st.Push('K'); st.Push('L');Now count the number of elements in the Stack −Console.WriteLine("Count: "+st.Count);Let us see the complete code −Example Live Demousing System; using System.Collections; namespace Demo { class Program { static void Main(string[] args) { ... Read More
In Java regex matches() matches the input string against the whole string as it add a ^ and $ at the end of the input string.so it will not match the substring. So for matching substring, you should use find().Exampleimport java.util.regex.*; class PatternMatchingExample { public static void main(String args[]) { String content = "aabbcc"; String string = "aa"; Pattern p = Pattern.compile(string); Matcher m = p.matcher(content); System.out.println(" 'aa' Match:"+ m.matches()); System.out.println(" 'aa' Match:"+ m.find()); } }Output'aa' Match:false 'aa' Match:true
A final variable can be explicitly initialized only once. A reference variable declared final can never be reassigned to refer to a different object.However, the data within the object can be changed. So, the state of the object can be changed but not the reference. As an array is also an object and it is referred by a reference variable which if set as final then cannot be reassigned. Let's see the examples for further explanation.Examplepublic class Tester { public static void main(String []args) { final int[] arr = {1, 2, 3}; ... Read More